Skip to content

Commit

Permalink
238: fixing lint issues with imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jac18281828 committed Jun 19, 2024
1 parent 63dcd9e commit 6d45145
Show file tree
Hide file tree
Showing 48 changed files with 281 additions and 288 deletions.
12 changes: 10 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
"plugins": [],
"rules": {
"avoid-suicide": "error",
"avoid-sha3": "warn"
"avoid-sha3": "warn",
"var-name-mixedcase": "off",
"func-name-mixedcase": "off",
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
]
}
}
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{
"label": "test",
"type": "shell",
"command": "forge test -vvv",
"command": "forge test -v",
"options": {
"cwd": "${workspaceFolder}"
},
Expand Down Expand Up @@ -116,4 +116,4 @@
}
}
]
}
}
16 changes: 8 additions & 8 deletions contracts/Auction.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";

import "../contracts/interfaces/SDCollateral/IAuction.sol";
import "../contracts/interfaces/IStaderStakePoolManager.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";
import { IAuction } from "../contracts/interfaces/SDCollateral/IAuction.sol";
import { IStaderStakePoolManager } from "../contracts/interfaces/IStaderStakePoolManager.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";

contract Auction is IAuction, AccessControlUpgradeable, ReentrancyGuardUpgradeable {
IStaderConfig public override staderConfig;
Expand Down
12 changes: 7 additions & 5 deletions contracts/ETHx.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;
import "./library/UtilLib.sol";

import "./interfaces/IStaderConfig.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { UtilLib } from "./library/UtilLib.sol";

import { IStaderConfig } from "./interfaces/IStaderConfig.sol";

/**
* @title ETHx token Contract
Expand Down
7 changes: 4 additions & 3 deletions contracts/L2/ETHx.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

/**
* @title ETHx token Contract for L2s
Expand Down
16 changes: 7 additions & 9 deletions contracts/NodeELRewardVault.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";
import { UtilLib } from "./library/UtilLib.sol";

import "./interfaces/IPoolUtils.sol";
import "./interfaces/IVaultProxy.sol";
import "./interfaces/INodeRegistry.sol";
import "./interfaces/INodeELRewardVault.sol";
import "./interfaces/IStaderStakePoolManager.sol";
import "./interfaces/IOperatorRewardsCollector.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IPoolUtils } from "./interfaces/IPoolUtils.sol";
import { IVaultProxy } from "./interfaces/IVaultProxy.sol";
import { INodeELRewardVault } from "./interfaces/INodeELRewardVault.sol";
import { IStaderStakePoolManager } from "./interfaces/IStaderStakePoolManager.sol";
import { IOperatorRewardsCollector } from "./interfaces/IOperatorRewardsCollector.sol";

contract NodeELRewardVault is INodeELRewardVault {
constructor() {}

/**
* @notice Allows the contract to receive ETH
* @dev execution layer rewards may be sent as plain ETH transfers
Expand Down
36 changes: 15 additions & 21 deletions contracts/OperatorRewardsCollector.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";

import "./interfaces/INodeRegistry.sol";
import "./interfaces/INodeELRewardVault.sol";
import "./interfaces/IPermissionlessNodeRegistry.sol";
import "./interfaces/IOperatorRewardsCollector.sol";
import "./interfaces/IStaderConfig.sol";
import "./interfaces/ISDUtilityPool.sol";
import "./interfaces/SDCollateral/ISDCollateral.sol";
import "./interfaces/IWETH.sol";
import "../contracts/interfaces/IStaderOracle.sol";

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";

import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { INodeELRewardVault } from "./interfaces/INodeELRewardVault.sol";
import { IPermissionlessNodeRegistry } from "./interfaces/IPermissionlessNodeRegistry.sol";
import { IOperatorRewardsCollector } from "./interfaces/IOperatorRewardsCollector.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { ISDUtilityPool, UserData, OperatorLiquidation } from "./interfaces/ISDUtilityPool.sol";
import { ISDCollateral } from "./interfaces/SDCollateral/ISDCollateral.sol";
import { IWETH } from "./interfaces/IWETH.sol";
import { IStaderOracle } from "../contracts/interfaces/IStaderOracle.sol";

contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpgradeable {
IStaderConfig public staderConfig;
Expand Down Expand Up @@ -46,22 +47,15 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg
emit DepositedFor(msg.sender, _receiver, msg.value);
}

event log_uint256(string message, uint256 value);

/**
* @notice Claims payouts for an operator, repaying any outstanding liquidations and transferring any remaining balance to the operator's rewards address.
* @dev This function first checks for any unpaid liquidations for the operator and repays them if necessary. Then, it transfers any remaining balance to the operator's reward address.
*/
function claim() external {
claimLiquidation(msg.sender);

emit log_uint256("withdrawableInEth(msg.sender)", withdrawableInEth(msg.sender));

uint256 amount = balances[msg.sender] > withdrawableInEth(msg.sender)
? withdrawableInEth(msg.sender)
: balances[msg.sender];

emit log_uint256("claim amount", amount);
_claim(msg.sender, amount);
}

Expand Down
14 changes: 7 additions & 7 deletions contracts/Penalty.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import "./interfaces/IPenalty.sol";
import "./interfaces/IRatedV1.sol";
import "./interfaces/IStaderOracle.sol";
import "./interfaces/IStaderConfig.sol";
import { UtilLib } from "./library/UtilLib.sol";

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { IPenalty } from "./interfaces/IPenalty.sol";
import { IStaderOracle } from "./interfaces/IStaderOracle.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IRatedV1 } from "./interfaces/IRatedV1.sol";

contract Penalty is IPenalty, AccessControlUpgradeable, ReentrancyGuardUpgradeable {
IStaderConfig public staderConfig;
Expand Down
32 changes: 16 additions & 16 deletions contracts/PermissionedNodeRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";

import "./library/ValidatorStatus.sol";
import "./interfaces/IStaderConfig.sol";
import "./interfaces/IVaultFactory.sol";
import "./interfaces/IPoolUtils.sol";
import "./interfaces/INodeRegistry.sol";
import "./interfaces/IPermissionedPool.sol";
import "./interfaces/IValidatorWithdrawalVault.sol";
import "./interfaces/SDCollateral/ISDCollateral.sol";
import "./interfaces/IPermissionedNodeRegistry.sol";

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";

import { ValidatorStatus } from "./library/ValidatorStatus.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IVaultFactory } from "./interfaces/IVaultFactory.sol";
import { IPoolUtils } from "./interfaces/IPoolUtils.sol";
import { Operator, Validator, INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { IPermissionedPool } from "./interfaces/IPermissionedPool.sol";
import { IValidatorWithdrawalVault } from "./interfaces/IValidatorWithdrawalVault.sol";
import { ISDCollateral } from "./interfaces/SDCollateral/ISDCollateral.sol";
import { IPermissionedNodeRegistry } from "./interfaces/IPermissionedNodeRegistry.sol";

contract PermissionedNodeRegistry is

Check warning on line 21 in contracts/PermissionedNodeRegistry.sol

View workflow job for this annotation

GitHub Actions / Run linters

Contract has 19 states declarations but allowed no more than 15
INodeRegistry,
Expand Down
30 changes: 14 additions & 16 deletions contracts/PermissionedPool.sol
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";

import "./library/ValidatorStatus.sol";

import "./interfaces/IStaderConfig.sol";
import "./interfaces/IVaultFactory.sol";
import "./interfaces/INodeRegistry.sol";
import "./interfaces/IStaderPoolBase.sol";
import "./interfaces/IDepositContract.sol";
import "./interfaces/IStaderInsuranceFund.sol";
import "./interfaces/IStaderStakePoolManager.sol";
import "./interfaces/IPermissionedNodeRegistry.sol";

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";

import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IVaultFactory } from "./interfaces/IVaultFactory.sol";
import { INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { IStaderPoolBase } from "./interfaces/IStaderPoolBase.sol";
import { IDepositContract } from "./interfaces/IDepositContract.sol";
import { IStaderInsuranceFund } from "./interfaces/IStaderInsuranceFund.sol";
import { IStaderStakePoolManager } from "./interfaces/IStaderStakePoolManager.sol";
import { IPermissionedNodeRegistry } from "./interfaces/IPermissionedNodeRegistry.sol";

contract PermissionedPool is IStaderPoolBase, AccessControlUpgradeable, ReentrancyGuardUpgradeable {
using Math for uint256;
Expand Down
38 changes: 19 additions & 19 deletions contracts/PermissionlessNodeRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";

import "./library/ValidatorStatus.sol";
import "./interfaces/IStaderConfig.sol";
import "./interfaces/IVaultFactory.sol";
import "./interfaces/IPoolUtils.sol";
import "./interfaces/INodeRegistry.sol";
import "./interfaces/ISDUtilityPool.sol";
import "./interfaces/IPermissionlessPool.sol";
import "./interfaces/INodeELRewardVault.sol";
import "./interfaces/IStaderInsuranceFund.sol";
import "./interfaces/IValidatorWithdrawalVault.sol";
import "./interfaces/SDCollateral/ISDCollateral.sol";
import "./interfaces/IPermissionlessNodeRegistry.sol";
import "./interfaces/IOperatorRewardsCollector.sol";

import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";

import { ValidatorStatus } from "./library/ValidatorStatus.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IVaultFactory } from "./interfaces/IVaultFactory.sol";
import { IPoolUtils } from "./interfaces/IPoolUtils.sol";
import { Operator, Validator, INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { ISDUtilityPool } from "./interfaces/ISDUtilityPool.sol";
import { IPermissionlessPool } from "./interfaces/IPermissionlessPool.sol";
import { INodeELRewardVault } from "./interfaces/INodeELRewardVault.sol";
import { IStaderInsuranceFund } from "./interfaces/IStaderInsuranceFund.sol";
import { IValidatorWithdrawalVault } from "./interfaces/IValidatorWithdrawalVault.sol";
import { ISDCollateral } from "./interfaces/SDCollateral/ISDCollateral.sol";
import { IPermissionlessNodeRegistry } from "./interfaces/IPermissionlessNodeRegistry.sol";
import { IOperatorRewardsCollector } from "./interfaces/IOperatorRewardsCollector.sol";

contract PermissionlessNodeRegistry is

Check warning on line 24 in contracts/PermissionlessNodeRegistry.sol

View workflow job for this annotation

GitHub Actions / Run linters

Contract has 18 states declarations but allowed no more than 15
INodeRegistry,
Expand Down
26 changes: 12 additions & 14 deletions contracts/PermissionlessPool.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";
import "./library/ValidatorStatus.sol";

import "./interfaces/IStaderConfig.sol";
import "./interfaces/IVaultFactory.sol";
import "./interfaces/INodeRegistry.sol";
import "./interfaces/IStaderPoolBase.sol";
import "./interfaces/IDepositContract.sol";
import "./interfaces/IStaderStakePoolManager.sol";
import "./interfaces/IPermissionlessNodeRegistry.sol";

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import { UtilLib } from "./library/UtilLib.sol";

import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IVaultFactory } from "./interfaces/IVaultFactory.sol";
import { INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { IStaderPoolBase } from "./interfaces/IStaderPoolBase.sol";
import { IDepositContract } from "./interfaces/IDepositContract.sol";
import { IPermissionlessNodeRegistry } from "./interfaces/IPermissionlessNodeRegistry.sol";

contract PermissionlessPool is IStaderPoolBase, AccessControlUpgradeable, ReentrancyGuardUpgradeable {
using Math for uint256;
Expand Down
14 changes: 7 additions & 7 deletions contracts/PoolSelector.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";
import { UtilLib } from "./library/UtilLib.sol";

import "./interfaces/IStaderConfig.sol";
import "./interfaces/IPoolSelector.sol";
import "./interfaces/IPoolUtils.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";
import { IPoolSelector } from "./interfaces/IPoolSelector.sol";
import { IPoolUtils } from "./interfaces/IPoolUtils.sol";

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

contract PoolSelector is IPoolSelector, AccessControlUpgradeable {
using Math for uint256;
Expand Down
11 changes: 6 additions & 5 deletions contracts/PoolUtils.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.16;

import "./library/UtilLib.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

import "./interfaces/IPoolUtils.sol";
import "./interfaces/IStaderPoolBase.sol";
import "./interfaces/IStaderConfig.sol";
import { UtilLib } from "./library/UtilLib.sol";

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { IPoolUtils } from "./interfaces/IPoolUtils.sol";
import { IStaderPoolBase } from "./interfaces/IStaderPoolBase.sol";
import { INodeRegistry } from "./interfaces/INodeRegistry.sol";
import { IStaderConfig } from "./interfaces/IStaderConfig.sol";

contract PoolUtils is IPoolUtils, AccessControlUpgradeable {
uint64 private constant PUBKEY_LENGTH = 48;
Expand Down
Loading

0 comments on commit 6d45145

Please sign in to comment.