Skip to content

Commit

Permalink
feat: added @defi-wonderland/solidity-utils
Browse files Browse the repository at this point in the history
* feat: added @defi-wonderland/solidity-utils

* feat: docgen (+ import order)

* feat: moved IBaseErrors.sol to @defi-wonderland/solidity-utils

* fix: governance() vs governor()
  • Loading branch information
0xJabberwock authored Feb 8, 2023
1 parent ab44125 commit 70c8619
Show file tree
Hide file tree
Showing 81 changed files with 466 additions and 793 deletions.
3 changes: 3 additions & 0 deletions docs/technical/IKeep3rHelperParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,6 @@ address poolAddress


bool isTKNToken0



2 changes: 1 addition & 1 deletion docs/technical/IUniV3PairManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Returns the pair manager's position in the corresponding UniswapV3 pool



The collected fees will be sent to governance
The collected fees will be sent to governor


### `burn(uint128 liquidity, uint256 amount0Min, uint256 amount1Min, address to) → uint256 amount0, uint256 amount1` (external)
Expand Down
24 changes: 24 additions & 0 deletions docs/technical/external/IKeep3rV1Proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@



### `governance() → address` (external)





### `pendingGovernance() → address` (external)





### `minter() → address` (external)


Expand Down Expand Up @@ -83,6 +95,18 @@



### `setGovernance(address _governance)` (external)





### `acceptGovernance()` (external)





### `setKeep3rV1Governance(address _governance)` (external)


Expand Down
10 changes: 0 additions & 10 deletions docs/technical/peripherals/IBaseErrors.md

This file was deleted.

24 changes: 0 additions & 24 deletions docs/technical/peripherals/IDustCollector.md

This file was deleted.

51 changes: 0 additions & 51 deletions docs/technical/peripherals/IGovernable.md

This file was deleted.

7 changes: 7 additions & 0 deletions docs/technical/peripherals/IKeep3rAccountance.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Disputes keepers, or if they're already disputed, it can resolve the case
Argument `bonding` can be the address of either a token or a liquidity


### `totalBonds() → uint256 _totalBonds` (external)

Tracks the total amount of bonded KP3Rs in the contract




### `workCompleted(address _keeper) → uint256 _workCompleted` (external)

Tracks the total KP3R earnings of a keeper since it started working
Expand Down
4 changes: 2 additions & 2 deletions docs/technical/peripherals/IKeep3rDisputable.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Creates/resolves disputes for jobs or keepers

### `dispute(address _jobOrKeeper)` (external)

Allows governance to create a dispute for a given keeper/job
Allows governor to create a dispute for a given keeper/job




### `resolve(address _jobOrKeeper)` (external)

Allows governance to resolve a dispute on a keeper/job
Allows governor to resolve a dispute on a keeper/job



Expand Down
4 changes: 2 additions & 2 deletions docs/technical/peripherals/IKeep3rJobDisputable.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Handles the actions that can be taken on a disputed job

### `slashTokenFromJob(address _job, address _token, uint256 _amount)` (external)

Allows governance or slasher to slash a job specific token
Allows governor or slasher to slash a job specific token




### `slashLiquidityFromJob(address _job, address _liquidity, uint256 _amount)` (external)

Allows governance or a slasher to slash liquidity from a job
Allows governor or slasher to slash liquidity from a job



Expand Down
2 changes: 1 addition & 1 deletion docs/technical/peripherals/IKeep3rKeeperDisputable.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Handles the actions that can be taken on a disputed keeper

### `slash(address _keeper, address _bonded, uint256 _bondAmount, uint256 _unbondAmount)` (external)

Allows governance to slash a keeper based on a dispute
Allows governor to slash a keeper based on a dispute



Expand Down
2 changes: 1 addition & 1 deletion docs/technical/peripherals/IKeep3rParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The inflation period is the denominator used to regulate the emission of KP3R

### `fee() → uint256 _amount` (external)

The fee to be sent to governance when a user adds liquidity to a job
The fee to be sent to governor when a user adds liquidity to a job



Expand Down
2 changes: 1 addition & 1 deletion docs/technical/peripherals/IMintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Sets a new address to be the minter

### `MinterSet(address _minter)`

Emitted when governance sets a new minter
Emitted when governor sets a new minter



Expand Down
7 changes: 0 additions & 7 deletions docs/technical/sidechain/IKeep3rSidechainAccountance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ Implements a view to get the amount of credits that can be withdrawn



### `totalBonds() → uint256 _totalBonds` (external)

The total amount of bonded wKP3Rs in the contract




### `virtualReserves() → int256 _virtualReserves` (external)

The surplus amount of wKP3Rs in escrow contract
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.7',
version: '0.8.8',
settings: {
optimizer: {
enabled: true,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@solidity-parser/parser": "0.13.2"
},
"dependencies": {
"@defi-wonderland/solidity-utils": "0.0.0-6c86c0fc",
"@openzeppelin/contracts": "4.3.0"
},
"devDependencies": {
Expand Down Expand Up @@ -125,7 +126,7 @@
"prettier": "2.3.1",
"prettier-plugin-organize-imports": "2.3.3",
"prettier-plugin-solidity": "1.0.0-beta.13",
"solc-0.8": "npm:[email protected].7-fixed",
"solc-0.8": "npm:[email protected].8",
"solhint": "3.3.6",
"solhint-plugin-prettier": "0.0.5",
"solidity-coverage": "0.7.16",
Expand Down
6 changes: 3 additions & 3 deletions solidity/contracts/Keep3r.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ pragma solidity >=0.8.4 <0.9.0;
import '../interfaces/IKeep3r.sol';
import './peripherals/jobs/Keep3rJobs.sol';
import './peripherals/keepers/Keep3rKeepers.sol';
import './peripherals/DustCollector.sol';
import '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';

contract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {
constructor(
address _governance,
address _governor,
address _keep3rHelper,
address _keep3rV1,
address _keep3rV1Proxy
) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}
) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governor) {}
}
4 changes: 2 additions & 2 deletions solidity/contracts/Keep3rHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ contract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {
constructor(
address _kp3r,
address _keep3rV2,
address _governance,
address _governor,
address _kp3rWethPool
) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}
) Keep3rHelperParameters(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}

/// @inheritdoc IKeep3rHelper
function quote(uint256 _eth) public view override returns (uint256 _amountOut) {
Expand Down
26 changes: 13 additions & 13 deletions solidity/contracts/Keep3rHelperParameters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ pragma solidity >=0.8.7 <0.9.0;

import './libraries/FullMath.sol';
import './libraries/TickMath.sol';
import '../interfaces/peripherals/IBaseErrors.sol';
import '../interfaces/IKeep3r.sol';
import '../interfaces/external/IKeep3rV1.sol';
import '../interfaces/IKeep3rHelperParameters.sol';
import './peripherals/Governable.sol';
import './Keep3rHelperParameters.sol';

import '@openzeppelin/contracts/utils/math/Math.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';
import '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';

contract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {
/// @inheritdoc IKeep3rHelperParameters
Expand Down Expand Up @@ -50,9 +50,9 @@ contract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governa
constructor(
address _kp3r,
address _keep3rV2,
address _governance,
address _governor,
address _kp3rWethPool
) Governable(_governance) {
) Governable(_governor) {
KP3R = _kp3r;
keep3rV2 = _keep3rV2;

Expand All @@ -62,44 +62,44 @@ contract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governa
}

/// @inheritdoc IKeep3rHelperParameters
function setKp3rWethPool(address _poolAddress) external override onlyGovernance {
function setKp3rWethPool(address _poolAddress) external override onlyGovernor {
if (_poolAddress == address(0)) revert ZeroAddress();
_setKp3rWethPool(_poolAddress);
}

/// @inheritdoc IKeep3rHelperParameters
function setMinBoost(uint256 _minBoost) external override onlyGovernance {
function setMinBoost(uint256 _minBoost) external override onlyGovernor {
minBoost = _minBoost;
emit MinBoostChange(minBoost);
}

/// @inheritdoc IKeep3rHelperParameters
function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {
function setMaxBoost(uint256 _maxBoost) external override onlyGovernor {
maxBoost = _maxBoost;
emit MaxBoostChange(maxBoost);
}

/// @inheritdoc IKeep3rHelperParameters
function setTargetBond(uint256 _targetBond) external override onlyGovernance {
function setTargetBond(uint256 _targetBond) external override onlyGovernor {
targetBond = _targetBond;
emit TargetBondChange(targetBond);
}

/// @inheritdoc IKeep3rHelperParameters
function setKeep3rV2(address _keep3rV2) external override onlyGovernance {
function setKeep3rV2(address _keep3rV2) external override onlyGovernor {
if (_keep3rV2 == address(0)) revert ZeroAddress();
keep3rV2 = _keep3rV2;
emit Keep3rV2Change(keep3rV2);
}

/// @inheritdoc IKeep3rHelperParameters
function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {
function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernor {
workExtraGas = _workExtraGas;
emit WorkExtraGasChange(workExtraGas);
}

/// @inheritdoc IKeep3rHelperParameters
function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {
function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernor {
_setQuoteTwapTime(_quoteTwapTime);
}

Expand All @@ -109,13 +109,13 @@ contract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governa
}

/// @inheritdoc IKeep3rHelperParameters
function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {
function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernor {
minBaseFee = _minBaseFee;
emit MinBaseFeeChange(minBaseFee);
}

/// @inheritdoc IKeep3rHelperParameters
function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {
function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernor {
minPriorityFee = _minPriorityFee;
emit MinPriorityFeeChange(minPriorityFee);
}
Expand Down
Loading

0 comments on commit 70c8619

Please sign in to comment.