diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..fd126eac --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Existing Dockerfile", + "build": { + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerfile": "../Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode", + "JuanBlanco.solidity" + ] + } + }, + "containerEnv": { + "PRIVATE_KEY": "${localEnv:PRIVATE_KEY}", + "PUBLIC_KEY": "${localEnv:PUBLIC_KEY}", + "RPC_URL": "${localEnv:RPC_URL}", + "OPG_URL": "${localEnv:OPG_URL}", + "OPS_URL": "${localEnv:OPS_URL}", + "ARS_URL": "${localEnv:ARS_URL}", + "HOLESKY_URL": "${localEnv:HOLESKY_URL}", + "ETHERSCAN_API_KEY": "${localEnv:ETHERSCAN_API_KEY}" + } +} \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/ci-image.yml b/.github/workflows/ci-image.yml new file mode 100644 index 00000000..ad15a609 --- /dev/null +++ b/.github/workflows/ci-image.yml @@ -0,0 +1,28 @@ +name: Dev Image CI +on: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - "*" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build and Push + uses: docker/build-push-action@v3 + with: + context: . + push: false + build-args: | + VERSION=latest diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..4f9546e8 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,27 @@ +name: Coverage +on: [workflow_dispatch, pull_request, push] +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + - name: npm install + run: | + npm ci --frozen-lockfile --production + - name: Run Forge coverage + run: | + forge coverage --report lcov + id: coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + fail_ci_if_error: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b17218dc..77c67775 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,38 +1,29 @@ name: Lint - on: + workflow_dispatch: push: branches: - main pull_request: - permissions: checks: write contents: write - jobs: run-linters: name: Run linters runs-on: ubuntu-latest - steps: - name: Check out Git repository uses: actions/checkout@v2 with: token: ${{ secrets.github_token }} - - - name: Set up node + - name: Set up nodejs uses: actions/setup-node@v1 with: node-version: 18 - - - name: Install dependencies - run: npm install --frozen-lockfile - - - name: Run linters - uses: wearerequired/lint-action@v2.1.0 - with: - github_token: ${{ secrets.github_token }} - prettier: true - prettier_extensions: 'js,json,jsx,md,ts,tsx,yaml,yml,sol' - continue_on_error: false + - name: install dependencies (npm) + run: npm ci --frozen-lockfile + - name: Prettier + run: npm run prettier:check + - name: Solhint + run: npm run lint diff --git a/.github/workflows/slither.yml b/.github/workflows/slither.yml index 1e0998f4..e014c61b 100644 --- a/.github/workflows/slither.yml +++ b/.github/workflows/slither.yml @@ -1,11 +1,9 @@ name: Slither Analysis - on: push: branches: - main pull_request: - jobs: analyze: runs-on: ubuntu-latest @@ -20,7 +18,6 @@ jobs: uses: actions/checkout@v2 with: token: ${{ secrets.github_token }} - - name: Run Slither uses: crytic/slither-action@v0.2.0 id: slither @@ -28,7 +25,6 @@ jobs: node-version: 16 sarif: results.sarif fail-on: config - - if: failure() uses: Ayrx/sarif_to_github_annotations@v0.2.2 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yml similarity index 62% rename from .github/workflows/tests.yaml rename to .github/workflows/tests.yml index 1555d60c..d8deb5c8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yml @@ -1,36 +1,31 @@ name: Tests - on: + workflow_dispatch: push: branches: - main pull_request: - permissions: checks: write contents: write - jobs: unit-tests: name: Unit Tests runs-on: ubuntu-latest - steps: - name: Check out Git repository uses: actions/checkout@v2 with: token: ${{ secrets.github_token }} - + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly - name: Set up node uses: actions/setup-node@v1 with: - node-version: 16 - + node-version: 18 - name: Install dependencies - run: npm install --frozen-lockfile - - - name: Compile - run: npx hardhat compile - - - name: Run unit tests - run: npx hardhat node & npx hardhat test + run: npm ci --frozen-lockfile + - name: solidity unit tests + run: forge test -v diff --git a/.prettierrc b/.prettierrc index 31ba22d8..617e1652 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,15 @@ { - "semi": false, - "singleQuote": true, - "printWidth": 120 -} + "semi": true, + "singleQuote": false, + "printWidth": 120, + "useTabs": false, + "bracketSpacing": true, + "plugins": [ + "prettier-plugin-solidity" + ], + "overrides": [ + { + "files": "*.sol" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..fc57c623 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,119 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "preinstall", + "type": "shell", + "command": "forge install", + "options": { + "cwd": "${workspaceFolder}" + }, + "group": { + "kind": "build" + } + }, + { + "label": "install", + "type": "shell", + "command": "npm ci", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "preinstall", + "group": { + "kind": "build" + } + }, + { + "label": "prettier", + "type": "shell", + "command": "npm run prettier:check", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "install", + "group": { + "kind": "build" + } + }, + { + "label": "lint", + "type": "shell", + "command": "npm run lint", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "prettier", + "group": { + "kind": "build" + } + }, + { + "label": "build", + "type": "shell", + "command": "forge build --sizes", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "lint", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "test", + "type": "shell", + "command": "forge test -vvv", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "lint", + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "coverage", + "type": "shell", + "command": "forge coverage", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "lint", + "group": { + "kind": "test", + "isDefault": false + } + }, + { + "label": "gas", + "type": "shell", + "command": "forge test --gas-report", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "lint", + "group": { + "kind": "test", + "isDefault": false + } + }, + { + "label": "slither", + "type": "shell", + "command": "slither .", + "options": { + "cwd": "${workspaceFolder}" + }, + "dependsOn": "lint", + "group": { + "kind": "test", + "isDefault": false + } + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..497204da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ghcr.io/collectivexyz/foundry:latest + +ARG PROJECT=ethx +WORKDIR /workspaces/${PROJECT} +RUN chown -R foundry:foundry . +COPY --chown=foundry:foundry . . +ENV USER=foundry +USER foundry +ENV PATH=${PATH}:~/.cargo/bin:/usr/local/go/bin + +RUN python3 -m pip install slither-analyzer --break-system-packages + +RUN yamlfmt -lint .github/workflows/*.yml + +RUN npm ci --frozen-lockfile +RUN npm run prettier:check +# RUN slither . +# RUN npm run lint +RUN forge test -v +RUN forge geiger --check contracts/*.sol contracts/*/*.sol \ No newline at end of file diff --git a/README.md b/README.md index a0aa2c55..a1ae2971 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Test](https://github.com/stader-labs/ethx/actions/workflows/ci-image.yml/badge.svg)](https://github.com/stader-labs/ethx/actions/workflows/ci-image.yml) + # Overview ETHx is a multi pool architecture for node operations, designed for decentralization, scalability, and resilience. This design is integral to our ability to democratize node operations and adapt to increasing demand. diff --git a/contracts/Auction.sol b/contracts/Auction.sol index 4a3da65b..2963bab1 100644 --- a/contracts/Auction.sol +++ b/contracts/Auction.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import '../contracts/interfaces/SDCollateral/IAuction.sol'; -import '../contracts/interfaces/IStaderStakePoolManager.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 "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract Auction is IAuction, AccessControlUpgradeable, ReentrancyGuardUpgradeable { IStaderConfig public override staderConfig; @@ -97,7 +97,7 @@ contract Auction is IAuction, AccessControlUpgradeable, ReentrancyGuardUpgradeab if (lotItem.ethExtracted) revert AlreadyClaimed(); lotItem.ethExtracted = true; - IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveEthFromAuction{value: ethAmount}(); + IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveEthFromAuction{ value: ethAmount }(); emit ETHClaimed(lotId, staderConfig.getStakePoolManager(), ethAmount); } @@ -126,7 +126,7 @@ contract Auction is IAuction, AccessControlUpgradeable, ReentrancyGuardUpgradeab lotItem.bids[msg.sender] -= withdrawalAmount; // send the funds - (bool success, ) = payable(msg.sender).call{value: withdrawalAmount}(''); + (bool success, ) = payable(msg.sender).call{ value: withdrawalAmount }(""); if (!success) revert ETHWithdrawFailed(); emit BidWithdrawn(lotId, msg.sender, withdrawalAmount); diff --git a/contracts/ETHx.sol b/contracts/ETHx.sol index 3140f8eb..8c5f9e56 100644 --- a/contracts/ETHx.sol +++ b/contracts/ETHx.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IStaderConfig.sol'; +import "./interfaces/IStaderConfig.sol"; -import '@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@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"; /** * @title ETHx token Contract @@ -18,8 +18,8 @@ contract ETHx is Initializable, ERC20Upgradeable, PausableUpgradeable, AccessCon event UpdatedStaderConfig(address indexed _staderConfig); IStaderConfig public staderConfig; - bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); - bytes32 public constant BURNER_ROLE = keccak256('BURNER_ROLE'); + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { @@ -30,7 +30,7 @@ contract ETHx is Initializable, ERC20Upgradeable, PausableUpgradeable, AccessCon UtilLib.checkNonZeroAddress(_admin); UtilLib.checkNonZeroAddress(_staderConfig); - __ERC20_init('ETHx', 'ETHx'); + __ERC20_init("ETHx", "ETHx"); __Pausable_init(); __AccessControl_init(); @@ -74,11 +74,7 @@ contract ETHx is Initializable, ERC20Upgradeable, PausableUpgradeable, AccessCon _unpause(); } - function _beforeTokenTransfer( - address from, - address to, - uint256 amount - ) internal override whenNotPaused { + function _beforeTokenTransfer(address from, address to, uint256 amount) internal override whenNotPaused { super._beforeTokenTransfer(from, to, amount); } diff --git a/contracts/NodeELRewardVault.sol b/contracts/NodeELRewardVault.sol index c216fa30..62570877 100644 --- a/contracts/NodeELRewardVault.sol +++ b/contracts/NodeELRewardVault.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./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 "./interfaces/IPoolUtils.sol"; +import "./interfaces/IVaultProxy.sol"; +import "./interfaces/INodeRegistry.sol"; +import "./interfaces/INodeELRewardVault.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; +import "./interfaces/IOperatorRewardsCollector.sol"; contract NodeELRewardVault is INodeELRewardVault { constructor() {} @@ -33,11 +33,11 @@ contract NodeELRewardVault is INodeELRewardVault { .calculateRewardShare(poolId, totalRewards); // Distribute rewards - IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveExecutionLayerRewards{value: userShare}(); + IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveExecutionLayerRewards{ value: userShare }(); // slither-disable-next-line arbitrary-send-eth UtilLib.sendValue(payable(staderConfig.getStaderTreasury()), protocolShare); address operator = UtilLib.getOperatorAddressByOperatorId(poolId, operatorId, staderConfig); - IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{value: operatorShare}( + IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{ value: operatorShare }( operator ); diff --git a/contracts/OperatorRewardsCollector.sol b/contracts/OperatorRewardsCollector.sol index e65b6eb4..873a224b 100644 --- a/contracts/OperatorRewardsCollector.sol +++ b/contracts/OperatorRewardsCollector.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +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 "./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 "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpgradeable { IStaderConfig public staderConfig; @@ -46,6 +46,8 @@ 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. @@ -53,9 +55,13 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg 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); } @@ -145,7 +151,7 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg operatorLiquidation.totalAmountInEth - operatorLiquidation.totalFeeInEth ); - weth.deposit{value: wETHDeposit}(); + weth.deposit{ value: wETHDeposit }(); if (weth.transferFrom(address(this), operatorLiquidation.liquidator, wETHDeposit) == false) revert WethTransferFailed(); balances[operator] -= wETHDeposit; @@ -157,7 +163,7 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg sdUtilityPool.completeLiquidation(operator); } else { // Transfer WETH to liquidator and ETH to treasury - weth.deposit{value: operatorLiquidation.totalAmountInEth - operatorLiquidation.totalFeeInEth}(); + weth.deposit{ value: operatorLiquidation.totalAmountInEth - operatorLiquidation.totalFeeInEth }(); if ( weth.transferFrom( address(this), @@ -182,7 +188,6 @@ contract OperatorRewardsCollector is IOperatorRewardsCollector, AccessControlUpg */ function _claim(address operator, uint256 amount) internal { uint256 maxWithdrawableInEth = withdrawableInEth(operator); - if (amount > maxWithdrawableInEth || amount > balances[operator]) revert InsufficientBalance(); balances[operator] -= amount; diff --git a/contracts/Penalty.sol b/contracts/Penalty.sol index a5df92e9..0a633e9c 100644 --- a/contracts/Penalty.sol +++ b/contracts/Penalty.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IPenalty.sol'; -import './interfaces/IRatedV1.sol'; -import './interfaces/IStaderOracle.sol'; -import './interfaces/IStaderConfig.sol'; +import "./interfaces/IPenalty.sol"; +import "./interfaces/IRatedV1.sol"; +import "./interfaces/IStaderOracle.sol"; +import "./interfaces/IStaderConfig.sol"; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract Penalty is IPenalty, AccessControlUpgradeable, ReentrancyGuardUpgradeable { IStaderConfig public staderConfig; @@ -28,11 +28,7 @@ contract Penalty is IPenalty, AccessControlUpgradeable, ReentrancyGuardUpgradeab _disableInitializers(); } - function initialize( - address _admin, - address _staderConfig, - address _ratedOracleAddress - ) external initializer { + function initialize(address _admin, address _staderConfig, address _ratedOracleAddress) external initializer { UtilLib.checkNonZeroAddress(_admin); UtilLib.checkNonZeroAddress(_staderConfig); UtilLib.checkNonZeroAddress(_ratedOracleAddress); diff --git a/contracts/PermissionedNodeRegistry.sol b/contracts/PermissionedNodeRegistry.sol index 52426a19..10e73a5d 100644 --- a/contracts/PermissionedNodeRegistry.sol +++ b/contracts/PermissionedNodeRegistry.sol @@ -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 "./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"; contract PermissionedNodeRegistry is INodeRegistry, @@ -103,12 +103,10 @@ contract PermissionedNodeRegistry is * @param _operatorRewardAddress eth1 address of operator to get rewards and withdrawals * @return feeRecipientAddress fee recipient address for all validator clients of a operator */ - function onboardNodeOperator(string calldata _operatorName, address payable _operatorRewardAddress) - external - override - whenNotPaused - returns (address feeRecipientAddress) - { + function onboardNodeOperator( + string calldata _operatorName, + address payable _operatorRewardAddress + ) external override whenNotPaused returns (address feeRecipientAddress) { address poolUtils = staderConfig.getPoolUtils(); if (IPoolUtils(poolUtils).poolAddressById(POOL_ID) != staderConfig.getPermissionedPool()) { revert DuplicatePoolIDOrPoolNotAdded(); @@ -189,11 +187,9 @@ contract PermissionedNodeRegistry is * @param _numValidators validator to deposit with permissioned pool * @return selectedOperatorCapacity operator wise count of validator to deposit */ - function allocateValidatorsAndUpdateOperatorId(uint256 _numValidators) - external - override - returns (uint256[] memory selectedOperatorCapacity) - { + function allocateValidatorsAndUpdateOperatorId( + uint256 _numValidators + ) external override returns (uint256[] memory selectedOperatorCapacity) { UtilLib.onlyStaderContract(msg.sender, staderConfig, staderConfig.PERMISSIONED_POOL()); // nextOperatorId is total operator count plus 1 selectedOperatorCapacity = new uint256[](nextOperatorId); @@ -609,12 +605,10 @@ contract PermissionedNodeRegistry is * * @return An array of `Validator` objects representing the active validators. */ - function getAllActiveValidators(uint256 _pageNumber, uint256 _pageSize) - external - view - override - returns (Validator[] memory) - { + function getAllActiveValidators( + uint256 _pageNumber, + uint256 _pageSize + ) external view override returns (Validator[] memory) { if (_pageNumber == 0) { revert PageNumberIsZero(); } diff --git a/contracts/PermissionedPool.sol b/contracts/PermissionedPool.sol index 93a4a525..a287590c 100644 --- a/contracts/PermissionedPool.sol +++ b/contracts/PermissionedPool.sol @@ -1,22 +1,22 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './library/ValidatorStatus.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 "./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 "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract PermissionedPool is IStaderPoolBase, AccessControlUpgradeable, ReentrancyGuardUpgradeable { using Math for uint256; @@ -149,7 +149,7 @@ contract PermissionedPool is IStaderPoolBase, AccessControlUpgradeable, Reentran ); //slither-disable-next-line arbitrary-send-eth - IDepositContract(ethDepositContract).deposit{value: fullDepositSize}( + IDepositContract(ethDepositContract).deposit{ value: fullDepositSize }( _pubkey[i], withdrawCredential, depositSignature, @@ -304,7 +304,7 @@ contract PermissionedPool is IStaderPoolBase, AccessControlUpgradeable, Reentran ); //slither-disable-next-line arbitrary-send-eth - IDepositContract(_ethDepositContract).deposit{value: preDepositSize}( + IDepositContract(_ethDepositContract).deposit{ value: preDepositSize }( pubkey, withdrawCredential, preDepositSignature, diff --git a/contracts/PermissionlessNodeRegistry.sol b/contracts/PermissionlessNodeRegistry.sol index 237012a1..fa6e666c 100644 --- a/contracts/PermissionlessNodeRegistry.sol +++ b/contracts/PermissionlessNodeRegistry.sol @@ -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 "./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"; contract PermissionlessNodeRegistry is INodeRegistry, @@ -129,7 +129,7 @@ contract PermissionlessNodeRegistry is bytes[] calldata _preDepositSignature, bytes[] calldata _depositSignature ) external payable override whenNotPaused { - addValidatorKeysWithUtilizeSD('', 0, _pubkey, _preDepositSignature, _depositSignature); + addValidatorKeysWithUtilizeSD("", 0, _pubkey, _preDepositSignature, _depositSignature); } /** @@ -305,11 +305,9 @@ contract PermissionlessNodeRegistry is } // allow NOs to opt in/out of socialize pool after coolDownPeriod - function changeSocializingPoolState(bool _optInForSocializingPool) - external - override - returns (address feeRecipientAddress) - { + function changeSocializingPoolState( + bool _optInForSocializingPool + ) external override returns (address feeRecipientAddress) { uint256 operatorId = onlyActiveOperator(msg.sender); if (operatorStructById[operatorId].optedForSocializingPool == _optInForSocializingPool) { revert NoChangeInState(); @@ -442,7 +440,7 @@ contract PermissionlessNodeRegistry is */ function transferCollateralToPool(uint256 _amount) external override nonReentrant { UtilLib.onlyStaderContract(msg.sender, staderConfig, staderConfig.PERMISSIONLESS_POOL()); - IPermissionlessPool(staderConfig.getPermissionlessPool()).receiveRemainingCollateralETH{value: _amount}(); + IPermissionlessPool(staderConfig.getPermissionlessPool()).receiveRemainingCollateralETH{ value: _amount }(); emit TransferredCollateralToPool(_amount); } @@ -538,12 +536,10 @@ contract PermissionlessNodeRegistry is * * @return An array of `Validator` objects representing the active validators. */ - function getAllActiveValidators(uint256 _pageNumber, uint256 _pageSize) - external - view - override - returns (Validator[] memory) - { + function getAllActiveValidators( + uint256 _pageNumber, + uint256 _pageSize + ) external view override returns (Validator[] memory) { if (_pageNumber == 0) { revert PageNumberIsZero(); } @@ -607,12 +603,10 @@ contract PermissionlessNodeRegistry is * * @return An array of `address` objects representing the nodeELRewardVault contract address. */ - function getAllNodeELVaultAddress(uint256 _pageNumber, uint256 _pageSize) - external - view - override - returns (address[] memory) - { + function getAllNodeELVaultAddress( + uint256 _pageNumber, + uint256 _pageSize + ) external view override returns (address[] memory) { if (_pageNumber == 0) { revert PageNumberIsZero(); } diff --git a/contracts/PermissionlessPool.sol b/contracts/PermissionlessPool.sol index 77358521..e568859f 100644 --- a/contracts/PermissionlessPool.sol +++ b/contracts/PermissionlessPool.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; -import './library/ValidatorStatus.sol'; +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 "./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 "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract PermissionlessPool is IStaderPoolBase, AccessControlUpgradeable, ReentrancyGuardUpgradeable { using Math for uint256; @@ -106,7 +106,7 @@ contract PermissionlessPool is IStaderPoolBase, AccessControlUpgradeable, Reentr staderConfig.getPreDepositSize() ); //slither-disable-next-line arbitrary-send-eth - IDepositContract(staderConfig.getETHDepositContract()).deposit{value: staderConfig.getPreDepositSize()}( + IDepositContract(staderConfig.getETHDepositContract()).deposit{ value: staderConfig.getPreDepositSize() }( _pubkey[i], withdrawCredential, _preDepositSignature[i], @@ -259,7 +259,7 @@ contract PermissionlessPool is IStaderPoolBase, AccessControlUpgradeable, Reentr withdrawCredential, _DEPOSIT_SIZE ); - IDepositContract(_ethDepositContract).deposit{value: _DEPOSIT_SIZE}( + IDepositContract(_ethDepositContract).deposit{ value: _DEPOSIT_SIZE }( pubkey, withdrawCredential, depositSignature, diff --git a/contracts/PoolSelector.sol b/contracts/PoolSelector.sol index c2e236f8..7903d803 100644 --- a/contracts/PoolSelector.sol +++ b/contracts/PoolSelector.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IStaderConfig.sol'; -import './interfaces/IPoolSelector.sol'; -import './interfaces/IPoolUtils.sol'; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/IPoolSelector.sol"; +import "./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 "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract PoolSelector is IPoolSelector, AccessControlUpgradeable { using Math for uint256; @@ -47,12 +47,10 @@ contract PoolSelector is IPoolSelector, AccessControlUpgradeable { * @param _newValidatorToRegister new validator that can be deposited for pool `_poolId` based on supply * @return selectedPoolCapacity validator count to deposit for pool */ - function computePoolAllocationForDeposit(uint8 _poolId, uint256 _newValidatorToRegister) - external - view - override - returns (uint256 selectedPoolCapacity) - { + function computePoolAllocationForDeposit( + uint8 _poolId, + uint256 _newValidatorToRegister + ) external view override returns (uint256 selectedPoolCapacity) { IPoolUtils poolUtils = IPoolUtils(staderConfig.getPoolUtils()); uint256 totalActiveValidatorCount = poolUtils.getTotalActiveValidatorCount(); uint256 totalValidatorsRequired = (totalActiveValidatorCount + _newValidatorToRegister); @@ -73,11 +71,9 @@ contract PoolSelector is IPoolSelector, AccessControlUpgradeable { * @return selectedPoolCapacity array of pool wise validator count to deposit * @return poolIdArray array of poolIDs */ - function poolAllocationForExcessETHDeposit(uint256 _excessETHAmount) - external - override - returns (uint256[] memory selectedPoolCapacity, uint8[] memory poolIdArray) - { + function poolAllocationForExcessETHDeposit( + uint256 _excessETHAmount + ) external override returns (uint256[] memory selectedPoolCapacity, uint8[] memory poolIdArray) { UtilLib.onlyStaderContract(msg.sender, staderConfig, staderConfig.STAKE_POOL_MANAGER()); uint256 ethToDeposit = _excessETHAmount; IPoolUtils poolUtils = IPoolUtils(staderConfig.getPoolUtils()); diff --git a/contracts/PoolUtils.sol b/contracts/PoolUtils.sol index dbb1579b..61426918 100644 --- a/contracts/PoolUtils.sol +++ b/contracts/PoolUtils.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IPoolUtils.sol'; -import './interfaces/IStaderPoolBase.sol'; -import './interfaces/IStaderConfig.sol'; +import "./interfaces/IPoolUtils.sol"; +import "./interfaces/IStaderPoolBase.sol"; +import "./interfaces/IStaderConfig.sol"; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract PoolUtils is IPoolUtils, AccessControlUpgradeable { uint64 private constant PUBKEY_LENGTH = 48; @@ -51,12 +51,10 @@ contract PoolUtils is IPoolUtils, AccessControlUpgradeable { * @param _poolId The Id of the pool to update. * @param _newPoolAddress The updated address of the pool. */ - function updatePoolAddress(uint8 _poolId, address _newPoolAddress) - external - override - onlyExistingPoolId(_poolId) - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updatePoolAddress( + uint8 _poolId, + address _newPoolAddress + ) external override onlyExistingPoolId(_poolId) onlyRole(DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(_newPoolAddress); if (INodeRegistry(IStaderPoolBase(_newPoolAddress).getNodeRegistry()).POOL_ID() != _poolId) { revert MismatchingPoolId(); @@ -115,37 +113,25 @@ contract PoolUtils is IPoolUtils, AccessControlUpgradeable { } /// @inheritdoc IPoolUtils - function getQueuedValidatorCountByPool(uint8 _poolId) - external - view - override - onlyExistingPoolId(_poolId) - returns (uint256) - { + function getQueuedValidatorCountByPool( + uint8 _poolId + ) external view override onlyExistingPoolId(_poolId) returns (uint256) { address nodeRegistry = getNodeRegistry(_poolId); return INodeRegistry(nodeRegistry).getTotalQueuedValidatorCount(); } /// @inheritdoc IPoolUtils - function getActiveValidatorCountByPool(uint8 _poolId) - public - view - override - onlyExistingPoolId(_poolId) - returns (uint256) - { + function getActiveValidatorCountByPool( + uint8 _poolId + ) public view override onlyExistingPoolId(_poolId) returns (uint256) { address nodeRegistry = getNodeRegistry(_poolId); return INodeRegistry(nodeRegistry).getTotalActiveValidatorCount(); } /// @inheritdoc IPoolUtils - function getSocializingPoolAddress(uint8 _poolId) - external - view - override - onlyExistingPoolId(_poolId) - returns (address) - { + function getSocializingPoolAddress( + uint8 _poolId + ) external view override onlyExistingPoolId(_poolId) returns (address) { return IStaderPoolBase(poolAddressById[_poolId]).getSocializingPoolAddress(); } @@ -248,16 +234,10 @@ contract PoolUtils is IPoolUtils, AccessControlUpgradeable { } //compute the share of rewards between user, protocol and operator - function calculateRewardShare(uint8 _poolId, uint256 _totalRewards) - external - view - override - returns ( - uint256 userShare, - uint256 operatorShare, - uint256 protocolShare - ) - { + function calculateRewardShare( + uint8 _poolId, + uint256 _totalRewards + ) external view override returns (uint256 userShare, uint256 operatorShare, uint256 protocolShare) { uint256 TOTAL_STAKED_ETH = staderConfig.getStakedEthPerNode(); uint256 collateralETH = getCollateralETH(_poolId); uint256 usersETH = TOTAL_STAKED_ETH - collateralETH; diff --git a/contracts/SDCollateral.sol b/contracts/SDCollateral.sol index 1de68474..683ea26c 100644 --- a/contracts/SDCollateral.sol +++ b/contracts/SDCollateral.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import '../contracts/interfaces/IPoolUtils.sol'; -import '../contracts/interfaces/SDCollateral/ISDCollateral.sol'; -import '../contracts/interfaces/SDCollateral/IAuction.sol'; -import '../contracts/interfaces/IStaderOracle.sol'; -import './interfaces/ISDUtilityPool.sol'; +import "../contracts/interfaces/IPoolUtils.sol"; +import "../contracts/interfaces/SDCollateral/ISDCollateral.sol"; +import "../contracts/interfaces/SDCollateral/IAuction.sol"; +import "../contracts/interfaces/IStaderOracle.sol"; +import "./interfaces/ISDUtilityPool.sol"; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; -import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract SDCollateral is ISDCollateral, AccessControlUpgradeable, ReentrancyGuardUpgradeable { IStaderConfig public override staderConfig; @@ -253,12 +253,10 @@ contract SDCollateral is ISDCollateral, AccessControlUpgradeable, ReentrancyGuar /// @notice returns minimum amount of SD required to onboard _numValidators in a pool /// @param _poolId pool id, where operator wants to onboard validators /// @param _numValidator number of validators to onBoard (including already onboarded, if any) - function getMinimumSDToBond(uint8 _poolId, uint256 _numValidator) - public - view - override - returns (uint256 _minSDToBond) - { + function getMinimumSDToBond( + uint8 _poolId, + uint256 _numValidator + ) public view override returns (uint256 _minSDToBond) { isPoolThresholdValid(_poolId); PoolThresholdInfo storage poolThreshold = poolThresholdbyPoolId[_poolId]; @@ -304,15 +302,9 @@ contract SDCollateral is ISDCollateral, AccessControlUpgradeable, ReentrancyGuar // HELPER - function getOperatorInfo(address _operator) - public - view - returns ( - uint8 _poolId, - uint256 _operatorId, - uint256 _validatorCount - ) - { + function getOperatorInfo( + address _operator + ) public view returns (uint8 _poolId, uint256 _operatorId, uint256 _validatorCount) { IPoolUtils poolUtils = IPoolUtils(staderConfig.getPoolUtils()); _poolId = poolUtils.getOperatorPoolId(_operator); INodeRegistry nodeRegistry = INodeRegistry(poolUtils.getNodeRegistry(_poolId)); diff --git a/contracts/SDIncentiveController.sol b/contracts/SDIncentiveController.sol index c22e02b1..26751a52 100644 --- a/contracts/SDIncentiveController.sol +++ b/contracts/SDIncentiveController.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import './library/UtilLib.sol'; -import './interfaces/IStaderConfig.sol'; -import './interfaces/ISDUtilityPool.sol'; -import './interfaces/ISDIncentiveController.sol'; +import "./library/UtilLib.sol"; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/ISDUtilityPool.sol"; +import "./interfaces/ISDIncentiveController.sol"; /// @title SDIncentiveController /// @notice This contract handles the distribution of reward tokens for the utility pool. diff --git a/contracts/SDUtilityPool.sol b/contracts/SDUtilityPool.sol index 1beb15a0..c0610a93 100644 --- a/contracts/SDUtilityPool.sol +++ b/contracts/SDUtilityPool.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; -import './interfaces/IStaderConfig.sol'; -import './interfaces/ISDIncentiveController.sol'; -import './interfaces/ISDUtilityPool.sol'; -import './interfaces/SDCollateral/ISDCollateral.sol'; -import './interfaces/IPoolUtils.sol'; -import './interfaces/IOperatorRewardsCollector.sol'; - -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; -import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; +import "./library/UtilLib.sol"; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/ISDIncentiveController.sol"; +import "./interfaces/ISDUtilityPool.sol"; +import "./interfaces/SDCollateral/ISDCollateral.sol"; +import "./interfaces/IPoolUtils.sol"; +import "./interfaces/IOperatorRewardsCollector.sol"; + +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract SDUtilityPool is ISDUtilityPool, AccessControlUpgradeable, PausableUpgradeable { using Math for uint256; @@ -166,12 +166,9 @@ contract SDUtilityPool is ISDUtilityPool, AccessControlUpgradeable, PausableUpgr * @param _sdAmount amount of SD to withdraw * @return _requestId generated request ID for withdrawal */ - function requestWithdrawWithSDAmount(uint256 _sdAmount) - external - override - whenNotPaused - returns (uint256 _requestId) - { + function requestWithdrawWithSDAmount( + uint256 _sdAmount + ) external override whenNotPaused returns (uint256 _requestId) { if (_sdAmount < MIN_SD_WITHDRAW_LIMIT) { revert InvalidInput(); } @@ -299,12 +296,10 @@ contract SDUtilityPool is ISDUtilityPool, AccessControlUpgradeable, PausableUpgr * @notice Sender repays on behalf of utilizer, returns actual repayment amount * @param repayAmount The amount to repay */ - function repayOnBehalf(address utilizer, uint256 repayAmount) - external - override - whenNotPaused - returns (uint256 repaidAmount, uint256 feePaid) - { + function repayOnBehalf( + address utilizer, + uint256 repayAmount + ) external override whenNotPaused returns (uint256 repaidAmount, uint256 feePaid) { accrueFee(); (repaidAmount, feePaid) = _repay(utilizer, repayAmount); } @@ -590,11 +585,9 @@ contract SDUtilityPool is ISDUtilityPool, AccessControlUpgradeable, PausableUpgr * @dev only `DEFAULT_ADMIN_ROLE` role can call * @param _minBlockDelayToFinalizeRequest new value of minBlockDelayToFinalizeRequest */ - function updateMinBlockDelayToFinalizeRequest(uint256 _minBlockDelayToFinalizeRequest) - external - override - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updateMinBlockDelayToFinalizeRequest( + uint256 _minBlockDelayToFinalizeRequest + ) external override onlyRole(DEFAULT_ADMIN_ROLE) { minBlockDelayToFinalizeRequest = _minBlockDelayToFinalizeRequest; emit UpdatedMinBlockDelayToFinalizeRequest(minBlockDelayToFinalizeRequest); } @@ -847,10 +840,10 @@ contract SDUtilityPool is ISDUtilityPool, AccessControlUpgradeable, PausableUpgr emit SDUtilized(utilizer, utilizeAmount); } - function _repay(address utilizer, uint256 repayAmount) - internal - returns (uint256 repayAmountFinal, uint256 feePaid) - { + function _repay( + address utilizer, + uint256 repayAmount + ) internal returns (uint256 repayAmountFinal, uint256 feePaid) { /* We fetch the amount the utilizer owes, with accumulated fee */ uint256 accountUtilizedPrev = _utilizerBalanceStoredInternal(utilizer); diff --git a/contracts/SocializingPool.sol b/contracts/SocializingPool.sol index 7d17a4a3..d5152ea7 100644 --- a/contracts/SocializingPool.sol +++ b/contracts/SocializingPool.sol @@ -2,18 +2,18 @@ pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/ISocializingPool.sol'; -import './interfaces/SDCollateral/ISDCollateral.sol'; -import './interfaces/IStaderStakePoolManager.sol'; -import './interfaces/IPermissionlessNodeRegistry.sol'; +import "./interfaces/ISocializingPool.sol"; +import "./interfaces/SDCollateral/ISDCollateral.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; +import "./interfaces/IPermissionlessNodeRegistry.sol"; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol'; -import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract SocializingPool is ISocializingPool, @@ -88,7 +88,7 @@ contract SocializingPool is value: _rewardsData.userETHRewards }(); - (bool success, ) = payable(staderConfig.getStaderTreasury()).call{value: _rewardsData.protocolETHRewards}(''); + (bool success, ) = payable(staderConfig.getStaderTreasury()).call{ value: _rewardsData.protocolETHRewards }(""); if (!success) { revert ETHTransferFailed(staderConfig.getStaderTreasury(), _rewardsData.protocolETHRewards); } @@ -143,7 +143,7 @@ contract SocializingPool is bool success; if (totalAmountETH > 0) { totalOperatorETHRewardsRemaining -= totalAmountETH; - (success, ) = payable(operatorRewardsAddr).call{value: totalAmountETH}(''); + (success, ) = payable(operatorRewardsAddr).call{ value: totalAmountETH }(""); if (!success) { revert ETHTransferFailed(operatorRewardsAddr, totalAmountETH); } @@ -243,11 +243,7 @@ contract SocializingPool is external view override - returns ( - uint256 currentIndex, - uint256 currentStartBlock, - uint256 currentEndBlock - ) + returns (uint256 currentIndex, uint256 currentStartBlock, uint256 currentEndBlock) { currentIndex = getCurrentRewardsIndex(); (currentStartBlock, currentEndBlock) = getRewardCycleDetails(currentIndex); diff --git a/contracts/StaderConfig.sol b/contracts/StaderConfig.sol index 304f2212..b4d1b367 100644 --- a/contracts/StaderConfig.sol +++ b/contracts/StaderConfig.sol @@ -1,75 +1,75 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IStaderConfig.sol'; +import "./interfaces/IStaderConfig.sol"; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract StaderConfig is IStaderConfig, AccessControlUpgradeable { // staked ETH per node on beacon chain i.e. 32 ETH - bytes32 public constant ETH_PER_NODE = keccak256('ETH_PER_NODE'); + bytes32 public constant ETH_PER_NODE = keccak256("ETH_PER_NODE"); //amount of ETH for pre-deposit on beacon chain i.e 1 ETH - bytes32 public constant PRE_DEPOSIT_SIZE = keccak256('PRE_DEPOSIT_SIZE'); + bytes32 public constant PRE_DEPOSIT_SIZE = keccak256("PRE_DEPOSIT_SIZE"); //amount of ETH for full deposit on beacon chain i.e 31 ETH - bytes32 public constant FULL_DEPOSIT_SIZE = keccak256('FULL_DEPOSIT_SIZE'); + bytes32 public constant FULL_DEPOSIT_SIZE = keccak256("FULL_DEPOSIT_SIZE"); // ETH to WEI ratio i.e 1e18 - bytes32 public constant DECIMALS = keccak256('DECIMALS'); + bytes32 public constant DECIMALS = keccak256("DECIMALS"); //Total fee bips - bytes32 public constant TOTAL_FEE = keccak256('TOTAL_FEE'); + bytes32 public constant TOTAL_FEE = keccak256("TOTAL_FEE"); //maximum length of operator name string - bytes32 public constant OPERATOR_MAX_NAME_LENGTH = keccak256('OPERATOR_MAX_NAME_LENGTH'); + bytes32 public constant OPERATOR_MAX_NAME_LENGTH = keccak256("OPERATOR_MAX_NAME_LENGTH"); - bytes32 public constant SOCIALIZING_POOL_CYCLE_DURATION = keccak256('SOCIALIZING_POOL_CYCLE_DURATION'); + bytes32 public constant SOCIALIZING_POOL_CYCLE_DURATION = keccak256("SOCIALIZING_POOL_CYCLE_DURATION"); bytes32 public constant SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD = - keccak256('SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD'); - bytes32 public constant REWARD_THRESHOLD = keccak256('REWARD_THRESHOLD'); - bytes32 public constant MIN_DEPOSIT_AMOUNT = keccak256('MIN_DEPOSIT_AMOUNT'); - bytes32 public constant MAX_DEPOSIT_AMOUNT = keccak256('MAX_DEPOSIT_AMOUNT'); - bytes32 public constant MIN_WITHDRAW_AMOUNT = keccak256('MIN_WITHDRAW_AMOUNT'); - bytes32 public constant MAX_WITHDRAW_AMOUNT = keccak256('MAX_WITHDRAW_AMOUNT'); + keccak256("SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD"); + bytes32 public constant REWARD_THRESHOLD = keccak256("REWARD_THRESHOLD"); + bytes32 public constant MIN_DEPOSIT_AMOUNT = keccak256("MIN_DEPOSIT_AMOUNT"); + bytes32 public constant MAX_DEPOSIT_AMOUNT = keccak256("MAX_DEPOSIT_AMOUNT"); + bytes32 public constant MIN_WITHDRAW_AMOUNT = keccak256("MIN_WITHDRAW_AMOUNT"); + bytes32 public constant MAX_WITHDRAW_AMOUNT = keccak256("MAX_WITHDRAW_AMOUNT"); //minimum delay between user requesting withdraw and request finalization bytes32 public constant MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST = - keccak256('MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST'); - bytes32 public constant WITHDRAWN_KEYS_BATCH_SIZE = keccak256('WITHDRAWN_KEYS_BATCH_SIZE'); - - bytes32 public constant ADMIN = keccak256('ADMIN'); - bytes32 public constant STADER_TREASURY = keccak256('STADER_TREASURY'); - - bytes32 public constant override POOL_UTILS = keccak256('POOL_UTILS'); - bytes32 public constant override POOL_SELECTOR = keccak256('POOL_SELECTOR'); - bytes32 public constant override SD_COLLATERAL = keccak256('SD_COLLATERAL'); - bytes32 public constant override OPERATOR_REWARD_COLLECTOR = keccak256('OPERATOR_REWARD_COLLECTOR'); - bytes32 public constant override VAULT_FACTORY = keccak256('VAULT_FACTORY'); - bytes32 public constant override STADER_ORACLE = keccak256('STADER_ORACLE'); - bytes32 public constant override AUCTION_CONTRACT = keccak256('AuctionContract'); - bytes32 public constant override PENALTY_CONTRACT = keccak256('PENALTY_CONTRACT'); - bytes32 public constant override PERMISSIONED_POOL = keccak256('PERMISSIONED_POOL'); - bytes32 public constant override STAKE_POOL_MANAGER = keccak256('STAKE_POOL_MANAGER'); - bytes32 public constant override ETH_DEPOSIT_CONTRACT = keccak256('ETH_DEPOSIT_CONTRACT'); - bytes32 public constant override PERMISSIONLESS_POOL = keccak256('PERMISSIONLESS_POOL'); - bytes32 public constant override USER_WITHDRAW_MANAGER = keccak256('USER_WITHDRAW_MANAGER'); - bytes32 public constant override STADER_INSURANCE_FUND = keccak256('STADER_INSURANCE_FUND'); - bytes32 public constant override PERMISSIONED_NODE_REGISTRY = keccak256('PERMISSIONED_NODE_REGISTRY'); - bytes32 public constant override PERMISSIONLESS_NODE_REGISTRY = keccak256('PERMISSIONLESS_NODE_REGISTRY'); - bytes32 public constant override PERMISSIONED_SOCIALIZING_POOL = keccak256('PERMISSIONED_SOCIALIZING_POOL'); - bytes32 public constant override PERMISSIONLESS_SOCIALIZING_POOL = keccak256('PERMISSIONLESS_SOCIALIZING_POOL'); + keccak256("MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST"); + bytes32 public constant WITHDRAWN_KEYS_BATCH_SIZE = keccak256("WITHDRAWN_KEYS_BATCH_SIZE"); + + bytes32 public constant ADMIN = keccak256("ADMIN"); + bytes32 public constant STADER_TREASURY = keccak256("STADER_TREASURY"); + + bytes32 public constant override POOL_UTILS = keccak256("POOL_UTILS"); + bytes32 public constant override POOL_SELECTOR = keccak256("POOL_SELECTOR"); + bytes32 public constant override SD_COLLATERAL = keccak256("SD_COLLATERAL"); + bytes32 public constant override OPERATOR_REWARD_COLLECTOR = keccak256("OPERATOR_REWARD_COLLECTOR"); + bytes32 public constant override VAULT_FACTORY = keccak256("VAULT_FACTORY"); + bytes32 public constant override STADER_ORACLE = keccak256("STADER_ORACLE"); + bytes32 public constant override AUCTION_CONTRACT = keccak256("AuctionContract"); + bytes32 public constant override PENALTY_CONTRACT = keccak256("PENALTY_CONTRACT"); + bytes32 public constant override PERMISSIONED_POOL = keccak256("PERMISSIONED_POOL"); + bytes32 public constant override STAKE_POOL_MANAGER = keccak256("STAKE_POOL_MANAGER"); + bytes32 public constant override ETH_DEPOSIT_CONTRACT = keccak256("ETH_DEPOSIT_CONTRACT"); + bytes32 public constant override PERMISSIONLESS_POOL = keccak256("PERMISSIONLESS_POOL"); + bytes32 public constant override USER_WITHDRAW_MANAGER = keccak256("USER_WITHDRAW_MANAGER"); + bytes32 public constant override STADER_INSURANCE_FUND = keccak256("STADER_INSURANCE_FUND"); + bytes32 public constant override PERMISSIONED_NODE_REGISTRY = keccak256("PERMISSIONED_NODE_REGISTRY"); + bytes32 public constant override PERMISSIONLESS_NODE_REGISTRY = keccak256("PERMISSIONLESS_NODE_REGISTRY"); + bytes32 public constant override PERMISSIONED_SOCIALIZING_POOL = keccak256("PERMISSIONED_SOCIALIZING_POOL"); + bytes32 public constant override PERMISSIONLESS_SOCIALIZING_POOL = keccak256("PERMISSIONLESS_SOCIALIZING_POOL"); bytes32 public constant override NODE_EL_REWARD_VAULT_IMPLEMENTATION = - keccak256('NODE_EL_REWARD_VAULT_IMPLEMENTATION'); + keccak256("NODE_EL_REWARD_VAULT_IMPLEMENTATION"); bytes32 public constant override VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION = - keccak256('VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION'); + keccak256("VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION"); //POR Feed Proxy - bytes32 public constant override ETH_BALANCE_POR_FEED = keccak256('ETH_BALANCE_POR_FEED'); - bytes32 public constant override ETHX_SUPPLY_POR_FEED = keccak256('ETHX_SUPPLY_POR_FEED'); + bytes32 public constant override ETH_BALANCE_POR_FEED = keccak256("ETH_BALANCE_POR_FEED"); + bytes32 public constant override ETHX_SUPPLY_POR_FEED = keccak256("ETHX_SUPPLY_POR_FEED"); //Roles - bytes32 public constant override MANAGER = keccak256('MANAGER'); - bytes32 public constant override OPERATOR = keccak256('OPERATOR'); + bytes32 public constant override MANAGER = keccak256("MANAGER"); + bytes32 public constant override OPERATOR = keccak256("OPERATOR"); - bytes32 public constant SD = keccak256('SD'); - bytes32 public constant ETHx = keccak256('ETHx'); + bytes32 public constant SD = keccak256("SD"); + bytes32 public constant ETHx = keccak256("ETHx"); mapping(bytes32 => uint256) private constantsMap; mapping(bytes32 => uint256) private variablesMap; @@ -77,8 +77,8 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { mapping(bytes32 => address) private contractsMap; mapping(bytes32 => address) private tokensMap; - bytes32 public constant override SD_UTILITY_POOL = keccak256('SD_UTILITY_POOL'); - bytes32 public constant override SD_INCENTIVE_CONTROLLER = keccak256('SD_INCENTIVE_CONTROLLER'); + bytes32 public constant override SD_UTILITY_POOL = keccak256("SD_UTILITY_POOL"); + bytes32 public constant override SD_INCENTIVE_CONTROLLER = keccak256("SD_INCENTIVE_CONTROLLER"); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { @@ -111,10 +111,9 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { setVariable(SOCIALIZING_POOL_CYCLE_DURATION, _socializingPoolCycleDuration); } - function updateSocializingPoolOptInCoolingPeriod(uint256 _SocializePoolOptInCoolingPeriod) - external - onlyRole(MANAGER) - { + function updateSocializingPoolOptInCoolingPeriod( + uint256 _SocializePoolOptInCoolingPeriod + ) external onlyRole(MANAGER) { setVariable(SOCIALIZING_POOL_OPT_IN_COOLING_PERIOD, _SocializePoolOptInCoolingPeriod); } @@ -158,10 +157,9 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { verifyDepositAndWithdrawLimits(); } - function updateMinBlockDelayToFinalizeWithdrawRequest(uint256 _minBlockDelay) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updateMinBlockDelayToFinalizeWithdrawRequest( + uint256 _minBlockDelay + ) external onlyRole(DEFAULT_ADMIN_ROLE) { setVariable(MIN_BLOCK_DELAY_TO_FINALIZE_WITHDRAW_REQUEST, _minBlockDelay); } @@ -247,24 +245,21 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { setContract(PERMISSIONED_NODE_REGISTRY, _permissionedNodeRegistry); } - function updatePermissionlessNodeRegistry(address _permissionlessNodeRegistry) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updatePermissionlessNodeRegistry( + address _permissionlessNodeRegistry + ) external onlyRole(DEFAULT_ADMIN_ROLE) { setContract(PERMISSIONLESS_NODE_REGISTRY, _permissionlessNodeRegistry); } - function updatePermissionedSocializingPool(address _permissionedSocializePool) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updatePermissionedSocializingPool( + address _permissionedSocializePool + ) external onlyRole(DEFAULT_ADMIN_ROLE) { setContract(PERMISSIONED_SOCIALIZING_POOL, _permissionedSocializePool); } - function updatePermissionlessSocializingPool(address _permissionlessSocializePool) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updatePermissionlessSocializingPool( + address _permissionlessSocializePool + ) external onlyRole(DEFAULT_ADMIN_ROLE) { setContract(PERMISSIONLESS_SOCIALIZING_POOL, _permissionlessSocializePool); } @@ -272,10 +267,9 @@ contract StaderConfig is IStaderConfig, AccessControlUpgradeable { setContract(NODE_EL_REWARD_VAULT_IMPLEMENTATION, _nodeELRewardVaultImpl); } - function updateValidatorWithdrawalVaultImplementation(address _validatorWithdrawalVaultImpl) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { + function updateValidatorWithdrawalVaultImplementation( + address _validatorWithdrawalVaultImpl + ) external onlyRole(DEFAULT_ADMIN_ROLE) { setContract(VALIDATOR_WITHDRAWAL_VAULT_IMPLEMENTATION, _validatorWithdrawalVaultImpl); } diff --git a/contracts/StaderInsuranceFund.sol b/contracts/StaderInsuranceFund.sol index 867cad2a..30e01549 100644 --- a/contracts/StaderInsuranceFund.sol +++ b/contracts/StaderInsuranceFund.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IStaderConfig.sol'; -import './interfaces/IPermissionedPool.sol'; -import './interfaces/IStaderInsuranceFund.sol'; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/IPermissionedPool.sol"; +import "./interfaces/IStaderInsuranceFund.sol"; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract StaderInsuranceFund is IStaderInsuranceFund, AccessControlUpgradeable, ReentrancyGuardUpgradeable { IStaderConfig public staderConfig; @@ -40,7 +40,7 @@ contract StaderInsuranceFund is IStaderInsuranceFund, AccessControlUpgradeable, } //slither-disable-next-line arbitrary-send-eth - (bool success, ) = payable(msg.sender).call{value: _amount}(''); + (bool success, ) = payable(msg.sender).call{ value: _amount }(""); if (!success) { revert TransferFailed(); } @@ -57,7 +57,7 @@ contract StaderInsuranceFund is IStaderInsuranceFund, AccessControlUpgradeable, if (address(this).balance < _amount) { revert InSufficientBalance(); } - IPermissionedPool(staderConfig.getPermissionedPool()).receiveInsuranceFund{value: _amount}(); + IPermissionedPool(staderConfig.getPermissionedPool()).receiveInsuranceFund{ value: _amount }(); } //update the address of staderConfig diff --git a/contracts/StaderOracle.sol b/contracts/StaderOracle.sol index fabf477d..8f0c8157 100644 --- a/contracts/StaderOracle.sol +++ b/contracts/StaderOracle.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './interfaces/IPoolUtils.sol'; -import './interfaces/IStaderOracle.sol'; -import './interfaces/ISocializingPool.sol'; -import './interfaces/INodeRegistry.sol'; -import './interfaces/IStaderStakePoolManager.sol'; +import "./interfaces/IPoolUtils.sol"; +import "./interfaces/IStaderOracle.sol"; +import "./interfaces/ISocializingPool.sol"; +import "./interfaces/INodeRegistry.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; -import '@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol'; -import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; +import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { bool public override erInspectionMode; @@ -52,13 +52,13 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad uint256[] private sdPrices; - bytes32 public constant ETHX_ER_UF = keccak256('ETHX_ER_UF'); // ETHx Exchange Rate, Balances Update Frequency - bytes32 public constant SD_PRICE_UF = keccak256('SD_PRICE_UF'); // SD Price Update Frequency Key - bytes32 public constant VALIDATOR_STATS_UF = keccak256('VALIDATOR_STATS_UF'); // Validator Status Update Frequency Key - bytes32 public constant WITHDRAWN_VALIDATORS_UF = keccak256('WITHDRAWN_VALIDATORS_UF'); // Withdrawn Validator Update Frequency Key - bytes32 public constant MISSED_ATTESTATION_PENALTY_UF = keccak256('MISSED_ATTESTATION_PENALTY_UF'); // Missed Attestation Penalty Update Frequency Key + bytes32 public constant ETHX_ER_UF = keccak256("ETHX_ER_UF"); // ETHx Exchange Rate, Balances Update Frequency + bytes32 public constant SD_PRICE_UF = keccak256("SD_PRICE_UF"); // SD Price Update Frequency Key + bytes32 public constant VALIDATOR_STATS_UF = keccak256("VALIDATOR_STATS_UF"); // Validator Status Update Frequency Key + bytes32 public constant WITHDRAWN_VALIDATORS_UF = keccak256("WITHDRAWN_VALIDATORS_UF"); // Withdrawn Validator Update Frequency Key + bytes32 public constant MISSED_ATTESTATION_PENALTY_UF = keccak256("MISSED_ATTESTATION_PENALTY_UF"); // Missed Attestation Penalty Update Frequency Key // Ready to Deposit Validators Update Frequency Key - bytes32 public constant VALIDATOR_VERIFICATION_DETAIL_UF = keccak256('VALIDATOR_VERIFICATION_DETAIL_UF'); + bytes32 public constant VALIDATOR_VERIFICATION_DETAIL_UF = keccak256("VALIDATOR_VERIFICATION_DETAIL_UF"); mapping(bytes32 => uint256) public updateFrequencyMap; /// @custom:oz-upgrades-unsafe-allow constructor @@ -122,14 +122,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad } /// @inheritdoc IStaderOracle - function submitExchangeRateData(ExchangeRate calldata _exchangeRate) - external - override - trustedNodeOnly - checkMinTrustedNodes - checkERInspectionMode - whenNotPaused - { + function submitExchangeRateData( + ExchangeRate calldata _exchangeRate + ) external override trustedNodeOnly checkMinTrustedNodes checkERInspectionMode whenNotPaused { if (isPORFeedBasedERData) { revert InvalidERDataSource(); } @@ -216,14 +211,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad /// updates operator reward balances on socializing pool /// @param _rewardsData contains rewards merkleRoot and rewards split info /// @dev _rewardsData.index should not be zero - function submitSocializingRewardsMerkleRoot(RewardsData calldata _rewardsData) - external - override - nonReentrant - trustedNodeOnly - checkMinTrustedNodes - whenNotPaused - { + function submitSocializingRewardsMerkleRoot( + RewardsData calldata _rewardsData + ) external override nonReentrant trustedNodeOnly checkMinTrustedNodes whenNotPaused { if (_rewardsData.reportingBlockNumber >= block.number) { revert ReportingFutureBlockData(); } @@ -336,13 +326,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad } /// @inheritdoc IStaderOracle - function submitValidatorStats(ValidatorStats calldata _validatorStats) - external - override - trustedNodeOnly - checkMinTrustedNodes - whenNotPaused - { + function submitValidatorStats( + ValidatorStats calldata _validatorStats + ) external override trustedNodeOnly checkMinTrustedNodes whenNotPaused { if (_validatorStats.reportingBlockNumber >= block.number) { revert ReportingFutureBlockData(); } @@ -410,14 +396,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad } /// @inheritdoc IStaderOracle - function submitWithdrawnValidators(WithdrawnValidators calldata _withdrawnValidators) - external - override - nonReentrant - trustedNodeOnly - checkMinTrustedNodes - whenNotPaused - { + function submitWithdrawnValidators( + WithdrawnValidators calldata _withdrawnValidators + ) external override nonReentrant trustedNodeOnly checkMinTrustedNodes whenNotPaused { if (_withdrawnValidators.reportingBlockNumber >= block.number) { revert ReportingFutureBlockData(); } @@ -471,14 +452,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad } /// @inheritdoc IStaderOracle - function submitValidatorVerificationDetail(ValidatorVerificationDetail calldata _validatorVerificationDetail) - external - override - nonReentrant - trustedNodeOnly - checkMinTrustedNodes - whenNotPaused - { + function submitValidatorVerificationDetail( + ValidatorVerificationDetail calldata _validatorVerificationDetail + ) external override nonReentrant trustedNodeOnly checkMinTrustedNodes whenNotPaused { if (_validatorVerificationDetail.reportingBlockNumber >= block.number) { revert ReportingFutureBlockData(); } @@ -551,13 +527,9 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad } /// @inheritdoc IStaderOracle - function submitMissedAttestationPenalties(MissedAttestationPenaltyData calldata _mapd) - external - override - trustedNodeOnly - checkMinTrustedNodes - whenNotPaused - { + function submitMissedAttestationPenalties( + MissedAttestationPenaltyData calldata _mapd + ) external override trustedNodeOnly checkMinTrustedNodes whenNotPaused { if (_mapd.reportingBlockNumber >= block.number) { revert ReportingFutureBlockData(); } @@ -737,10 +709,10 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad return (exchangeRate); } - function attestSubmission(bytes32 _nodeSubmissionKey, bytes32 _submissionCountKey) - internal - returns (uint8 _submissionCount) - { + function attestSubmission( + bytes32 _nodeSubmissionKey, + bytes32 _submissionCountKey + ) internal returns (uint8 _submissionCount) { // Check & update node submission status if (nodeSubmissionKeys[_nodeSubmissionKey]) { revert DuplicateSubmissionFromNode(); @@ -754,15 +726,7 @@ contract StaderOracle is IStaderOracle, AccessControlUpgradeable, PausableUpgrad return lastReportedSDPriceData.sdPriceInETH; } - function getPORFeedData() - internal - view - returns ( - uint256, - uint256, - uint256 - ) - { + function getPORFeedData() internal view returns (uint256, uint256, uint256) { (, int256 totalETHBalanceInInt, , , ) = AggregatorV3Interface(staderConfig.getETHBalancePORFeedProxy()) .latestRoundData(); (, int256 totalETHXSupplyInInt, , , ) = AggregatorV3Interface(staderConfig.getETHXSupplyPORFeedProxy()) diff --git a/contracts/StaderStakePoolsManager.sol b/contracts/StaderStakePoolsManager.sol index 5a1c168c..7ef0af52 100644 --- a/contracts/StaderStakePoolsManager.sol +++ b/contracts/StaderStakePoolsManager.sol @@ -2,22 +2,22 @@ pragma solidity 0.8.16; -import './library/UtilLib.sol'; - -import './ETHx.sol'; -import './interfaces/IPoolUtils.sol'; -import './interfaces/IPoolSelector.sol'; -import './interfaces/IStaderConfig.sol'; -import './interfaces/IStaderOracle.sol'; -import './interfaces/IStaderPoolBase.sol'; -import './interfaces/IUserWithdrawalManager.sol'; -import './interfaces/IStaderStakePoolManager.sol'; - -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/utils/math/SafeMath.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; +import "./library/UtilLib.sol"; + +import "./ETHx.sol"; +import "./interfaces/IPoolUtils.sol"; +import "./interfaces/IPoolSelector.sol"; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/IStaderOracle.sol"; +import "./interfaces/IStaderPoolBase.sol"; +import "./interfaces/IUserWithdrawalManager.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; + +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; /** * @title Liquid Staking Pool Implementation @@ -99,7 +99,7 @@ contract StaderStakePoolsManager is function transferETHToUserWithdrawManager(uint256 _amount) external override nonReentrant whenNotPaused { UtilLib.onlyStaderContract(msg.sender, staderConfig, staderConfig.USER_WITHDRAW_MANAGER()); //slither-disable-next-line arbitrary-send-eth - (bool success, ) = payable(staderConfig.getUserWithdrawManager()).call{value: _amount}(''); + (bool success, ) = payable(staderConfig.getUserWithdrawManager()).call{ value: _amount }(""); if (!success) { revert TransferFailed(); } @@ -172,13 +172,10 @@ contract StaderStakePoolsManager is * @return _shares amount of ETHx token minted and sent to receiver * @dev emits an event with _referralId */ - function deposit(address _receiver, string calldata _referralId) - external - payable - override - whenNotPaused - returns (uint256 _shares) - { + function deposit( + address _receiver, + string calldata _referralId + ) external payable override whenNotPaused returns (uint256 _shares) { _shares = deposit(_receiver); emit DepositReferral(msg.sender, _receiver, msg.value, _shares, _referralId); } @@ -226,7 +223,7 @@ contract StaderStakePoolsManager is } address poolAddress = poolUtils.poolAddressById(_poolId); //slither-disable-next-line arbitrary-send-eth - IStaderPoolBase(poolAddress).stakeUserETHToBeaconChain{value: selectedPoolCapacity * poolDepositSize}(); + IStaderPoolBase(poolAddress).stakeUserETHToBeaconChain{ value: selectedPoolCapacity * poolDepositSize }(); emit ETHTransferredToPool(_poolId, poolAddress, selectedPoolCapacity * poolDepositSize); } @@ -262,7 +259,7 @@ contract StaderStakePoolsManager is lastExcessETHDepositBlock = block.number; //slither-disable-next-line arbitrary-send-eth - IStaderPoolBase(poolAddress).stakeUserETHToBeaconChain{value: validatorToDeposit * poolDepositSize}(); + IStaderPoolBase(poolAddress).stakeUserETHToBeaconChain{ value: validatorToDeposit * poolDepositSize }(); emit ETHTransferredToPool(i, poolAddress, validatorToDeposit * poolDepositSize); } } @@ -324,22 +321,14 @@ contract StaderStakePoolsManager is * * NOTE: Make sure to keep this function consistent with {initialConvertToShares} when overriding it. */ - function initialConvertToAssets( - uint256 _shares, - Math.Rounding /*rounding*/ - ) internal pure returns (uint256) { + function initialConvertToAssets(uint256 _shares, Math.Rounding /*rounding*/) internal pure returns (uint256) { return _shares; } /** * @dev Deposit/mint common workflow. */ - function _deposit( - address _caller, - address _receiver, - uint256 _assets, - uint256 _shares - ) internal { + function _deposit(address _caller, address _receiver, uint256 _assets, uint256 _shares) internal { ETHx(staderConfig.getETHxToken()).mint(_receiver, _shares); emit Deposited(_caller, _receiver, _assets, _shares); } diff --git a/contracts/UserWithdrawalManager.sol b/contracts/UserWithdrawalManager.sol index 78722d6f..adcd83b6 100644 --- a/contracts/UserWithdrawalManager.sol +++ b/contracts/UserWithdrawalManager.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; +import "./library/UtilLib.sol"; -import './ETHx.sol'; -import './interfaces/IStaderConfig.sol'; -import './interfaces/IStaderOracle.sol'; -import './interfaces/IStaderStakePoolManager.sol'; -import './interfaces/IUserWithdrawalManager.sol'; +import "./ETHx.sol"; +import "./interfaces/IStaderConfig.sol"; +import "./interfaces/IStaderOracle.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; +import "./interfaces/IUserWithdrawalManager.sol"; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; -import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract UserWithdrawalManager is IUserWithdrawalManager, @@ -244,7 +244,7 @@ contract UserWithdrawalManager is } //slither-disable-next-line arbitrary-send-eth - (bool success, ) = _recipient.call{value: _amount}(''); + (bool success, ) = _recipient.call{ value: _amount }(""); if (!success) { revert ETHTransferFailed(); } diff --git a/contracts/ValidatorWithdrawalVault.sol b/contracts/ValidatorWithdrawalVault.sol index 1a1ec996..0812cb90 100644 --- a/contracts/ValidatorWithdrawalVault.sol +++ b/contracts/ValidatorWithdrawalVault.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; -import './library/ValidatorStatus.sol'; +import "./library/UtilLib.sol"; +import "./library/ValidatorStatus.sol"; -import './VaultProxy.sol'; -import './interfaces/IPenalty.sol'; -import './interfaces/IPoolUtils.sol'; -import './interfaces/INodeRegistry.sol'; -import './interfaces/IStaderStakePoolManager.sol'; -import './interfaces/IValidatorWithdrawalVault.sol'; -import './interfaces/SDCollateral/ISDCollateral.sol'; -import './interfaces/IOperatorRewardsCollector.sol'; +import "./VaultProxy.sol"; +import "./interfaces/IPenalty.sol"; +import "./interfaces/IPoolUtils.sol"; +import "./interfaces/INodeRegistry.sol"; +import "./interfaces/IStaderStakePoolManager.sol"; +import "./interfaces/IValidatorWithdrawalVault.sol"; +import "./interfaces/SDCollateral/ISDCollateral.sol"; +import "./interfaces/IOperatorRewardsCollector.sol"; -import '@openzeppelin/contracts/utils/math/Math.sol'; +import "@openzeppelin/contracts/utils/math/Math.sol"; contract ValidatorWithdrawalVault is IValidatorWithdrawalVault { bool internal vaultSettleStatus; @@ -43,9 +43,9 @@ contract ValidatorWithdrawalVault is IValidatorWithdrawalVault { .calculateRewardShare(poolId, totalRewards); // Distribute rewards - IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveWithdrawVaultUserShare{value: userShare}(); + IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveWithdrawVaultUserShare{ value: userShare }(); UtilLib.sendValue(payable(staderConfig.getStaderTreasury()), protocolShare); - IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{value: operatorShare}( + IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{ value: operatorShare }( getOperatorAddress(poolId, validatorId, staderConfig) ); emit DistributedRewards(userShare, operatorShare, protocolShare); @@ -74,9 +74,9 @@ contract ValidatorWithdrawalVault is IValidatorWithdrawalVault { // Final settlement vaultSettleStatus = true; IPenalty(staderConfig.getPenaltyContract()).markValidatorSettled(poolId, validatorId); - IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveWithdrawVaultUserShare{value: userShare}(); + IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveWithdrawVaultUserShare{ value: userShare }(); UtilLib.sendValue(payable(staderConfig.getStaderTreasury()), protocolShare); - IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{value: operatorShare}( + IOperatorRewardsCollector(staderConfig.getOperatorRewardsCollector()).depositFor{ value: operatorShare }( getOperatorAddress(poolId, validatorId, staderConfig) ); emit SettledFunds(userShare, operatorShare, protocolShare); @@ -85,11 +85,7 @@ contract ValidatorWithdrawalVault is IValidatorWithdrawalVault { function calculateValidatorWithdrawalShare() public view - returns ( - uint256 _userShare, - uint256 _operatorShare, - uint256 _protocolShare - ) + returns (uint256 _userShare, uint256 _operatorShare, uint256 _protocolShare) { uint8 poolId = VaultProxy(payable(address(this))).poolId(); IStaderConfig staderConfig = VaultProxy(payable(address(this))).staderConfig(); diff --git a/contracts/VaultProxy.sol b/contracts/VaultProxy.sol index ce3421e7..b32b5ab9 100644 --- a/contracts/VaultProxy.sol +++ b/contracts/VaultProxy.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './library/UtilLib.sol'; -import './interfaces/IVaultProxy.sol'; +import "./library/UtilLib.sol"; +import "./interfaces/IVaultProxy.sol"; //contract to delegate call to respective vault implementation based on the flag of 'isValidatorWithdrawalVault' contract VaultProxy is IVaultProxy { @@ -19,12 +19,7 @@ contract VaultProxy is IVaultProxy { } //initialise the vault proxy with data - function initialise( - bool _isValidatorWithdrawalVault, - uint8 _poolId, - uint256 _id, - address _staderConfig - ) external { + function initialise(bool _isValidatorWithdrawalVault, uint8 _poolId, uint256 _id, address _staderConfig) external { if (isInitialized) { revert AlreadyInitialized(); } diff --git a/package-lock.json b/package-lock.json index 8b8cc39b..ae7ab9eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,8 +29,9 @@ "@typechain/hardhat": "^6.1.4", "axios": "^0.27.2", "hardhat": "^2.9.9", - "prettier": "^2.7.1", - "prettier-plugin-solidity": "^1.0.0-beta.24", + "prettier": "3.2.5", + "prettier-plugin-solidity": "1.3.1", + "solhint": "4.5.2", "typechain": "^8.1.1" } }, @@ -1728,6 +1729,101 @@ "hardhat": "^2.0.0" } }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/antlr4": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.7.1.tgz", + "integrity": "sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ==", + "dev": true + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/commander": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", + "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "dev": true + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true, + "optional": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@nomiclabs/hardhat-solhint/node_modules/solhint": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-2.3.1.tgz", + "integrity": "sha512-wP/G+Dqj8LNWlCI9Mt6XiQRWQfZwv1rkZe/V+HKtip5SAZJVvp144PdH28KE45ZvR99Hhrp/Mujt74fSmXsFiw==", + "dev": true, + "dependencies": { + "ajv": "^6.6.1", + "antlr4": "4.7.1", + "chalk": "^2.4.2", + "commander": "2.18.0", + "cosmiconfig": "^5.0.7", + "eslint": "^5.6.0", + "fast-diff": "^1.1.2", + "glob": "^7.1.3", + "ignore": "^4.0.6", + "js-yaml": "^3.12.0", + "lodash": "^4.17.11", + "semver": "^6.3.0" + }, + "bin": { + "solhint": "solhint.js" + }, + "optionalDependencies": { + "prettier": "^1.14.3" + } + }, "node_modules/@openzeppelin/contracts": { "version": "4.9.0", "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.9.0.tgz", @@ -1946,6 +2042,41 @@ "node": ">=8" } }, + "node_modules/@pnpm/config.env-replace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", + "integrity": "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==", + "dev": true, + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/network.ca-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz", + "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==", + "dev": true, + "dependencies": { + "graceful-fs": "4.2.10" + }, + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/npm-conf": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-2.2.2.tgz", + "integrity": "sha512-UA91GwWPhFExt3IizW6bOeY/pQ0BkuNwKjk9iQW9KqxluGCrg4VenZ0/L+2Y0+ZOtme72EVvg6v0zo3AMQRCeA==", + "dev": true, + "dependencies": { + "@pnpm/config.env-replace": "^1.1.0", + "@pnpm/network.ca-file": "^1.0.1", + "config-chain": "^1.1.11" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -2106,6 +2237,7 @@ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.3.tgz", "integrity": "sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==", "dev": true, + "peer": true, "dependencies": { "antlr4ts": "^0.5.0-alpha.4" } @@ -2373,6 +2505,12 @@ "@types/node": "*" } }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true + }, "node_modules/@types/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", @@ -2719,16 +2857,20 @@ } }, "node_modules/antlr4": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.7.1.tgz", - "integrity": "sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ==", - "dev": true + "version": "4.13.1-patch-1", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.13.1-patch-1.tgz", + "integrity": "sha512-OjFLWWLzDMV9rdFhpvroCWR4ooktNg9/nvVYSA5z28wuVpU36QUNuioR1XLnQtcjVlf8npjyz593PxnU/f/Cow==", + "dev": true, + "engines": { + "node": ">=16" + } }, "node_modules/antlr4ts": { "version": "0.5.0-alpha.4", "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/anymatch": { "version": "3.1.2", @@ -2867,12 +3009,17 @@ "node": "*" } }, + "node_modules/ast-parents": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/ast-parents/-/ast-parents-0.0.1.tgz", + "integrity": "sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==", + "dev": true + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -3338,6 +3485,15 @@ "bytes32": "bin.js" } }, + "node_modules/cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, "node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -3908,6 +4064,16 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dev": true, + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -4097,9 +4263,9 @@ } }, "node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -4839,9 +5005,9 @@ } }, "node_modules/eslint/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -4973,9 +5139,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -6331,6 +6497,15 @@ "node": ">= 0.12" } }, + "node_modules/form-data-encoder": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", + "integrity": "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==", + "dev": true, + "engines": { + "node": ">= 14.17" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -6997,6 +7172,19 @@ "npm": ">=1.3.7" } }, + "node_modules/http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", + "dev": true, + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -7135,8 +7323,7 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "peer": true + "dev": true }, "node_modules/inquirer": { "version": "6.5.2", @@ -7718,6 +7905,12 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", @@ -7820,6 +8013,21 @@ "node": ">=6" } }, + "node_modules/latest-version": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-7.0.0.tgz", + "integrity": "sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg==", + "dev": true, + "dependencies": { + "package-json": "^8.1.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/level": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", @@ -7901,6 +8109,12 @@ "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.14.tgz", "integrity": "sha512-McGS7GV/WjJ2KjfOGhJU1oJn29RYeo7Q+RpANRbUNMQ9gj5XArpbjurSuyYPTejFwbaUojstQ4XyWCrAzGOUXw==" }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "node_modules/locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -7930,8 +8144,7 @@ "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/log-symbols": { "version": "4.1.0", @@ -8967,86 +9180,327 @@ "node": ">=4" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "node_modules/package-json": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-8.1.1.tgz", + "integrity": "sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA==", "dev": true, "dependencies": { - "callsites": "^3.0.0" + "got": "^12.1.0", + "registry-auth-token": "^5.0.1", + "registry-url": "^6.0.0", + "semver": "^7.3.7" }, "engines": { - "node": ">=6" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parent-module/node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "node_modules/package-json/node_modules/@sindresorhus/is": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", "dev": true, "engines": { - "node": ">=6" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" } }, - "node_modules/parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "node_modules/package-json/node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dev": true, "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" } }, - "node_modules/parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==", + "node_modules/package-json/node_modules/cacheable-request": { + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", "dev": true, - "peer": true - }, - "node_modules/parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + "dependencies": { + "@types/http-cache-semantics": "^4.0.2", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.3", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + } }, - "node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "node_modules/package-json/node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", "dev": true, "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "mimic-response": "^3.1.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "node_modules/package-json/node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, "engines": { - "node": ">= 0.8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "node_modules/package-json/node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", "dev": true, "engines": { - "node": ">=4" + "node": ">=10" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { + "node_modules/package-json/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/got": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", + "integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^5.2.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^10.2.8", + "decompress-response": "^6.0.0", + "form-data-encoder": "^2.1.2", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/package-json/node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/package-json/node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/package-json/node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/package-json/node_modules/mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/normalize-url": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "dev": true, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/package-json/node_modules/responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "dev": true, + "dependencies": { + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/package-json/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module/node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/parse-cache-control": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", + "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==", + "dev": true, + "peer": true + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { "node": ">=0.10.0" } }, @@ -9080,7 +9534,6 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -9135,6 +9588,15 @@ "node": ">=6" } }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -9153,58 +9615,43 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" } }, "node_modules/prettier-plugin-solidity": { - "version": "1.0.0-beta.24", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz", - "integrity": "sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.3.1.tgz", + "integrity": "sha512-MN4OP5I2gHAzHZG1wcuJl0FsLS3c4Cc5494bbg+6oQWBPuEamjwDvmGfFMZ6NFzsh3Efd9UUxeT7ImgjNH4ozA==", "dev": true, "dependencies": { - "@solidity-parser/parser": "^0.14.3", - "emoji-regex": "^10.1.0", - "escape-string-regexp": "^4.0.0", - "semver": "^7.3.7", - "solidity-comments-extractor": "^0.0.7", - "string-width": "^4.2.3" + "@solidity-parser/parser": "^0.17.0", + "semver": "^7.5.4", + "solidity-comments-extractor": "^0.0.8" }, "engines": { - "node": ">=12" + "node": ">=16" }, "peerDependencies": { - "prettier": "^2.3.0" + "prettier": ">=2.3.0" } }, - "node_modules/prettier-plugin-solidity/node_modules/emoji-regex": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", - "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==", + "node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/parser": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.17.0.tgz", + "integrity": "sha512-Nko8R0/kUo391jsEHHxrGM07QFdnPGvlmox4rmH0kNiNAashItAilhy4Mv4pK5gQmW5f4sXAF58fwJbmlkGcVw==", "dev": true }, - "node_modules/prettier-plugin-solidity/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/prettier-plugin-solidity/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -9218,9 +9665,9 @@ } }, "node_modules/prettier-plugin-solidity/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -9295,6 +9742,12 @@ "signal-exit": "^3.0.2" } }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "dev": true + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -9395,6 +9848,18 @@ } ] }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -9434,6 +9899,30 @@ "node": ">= 0.8" } }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -9532,6 +10021,33 @@ "node": ">=6.5.0" } }, + "node_modules/registry-auth-token": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", + "integrity": "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==", + "dev": true, + "dependencies": { + "@pnpm/npm-conf": "^2.1.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/registry-url": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-6.0.1.tgz", + "integrity": "sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q==", + "dev": true, + "dependencies": { + "rc": "1.2.8" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/req-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-2.0.0.tgz", @@ -9676,6 +10192,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, "node_modules/resolve-from": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", @@ -10231,7 +10753,6 @@ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, - "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -10249,7 +10770,6 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "peer": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -10265,7 +10785,6 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "peer": true, "dependencies": { "color-name": "~1.1.4" }, @@ -10277,8 +10796,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "peer": true + "dev": true }, "node_modules/solc": { "version": "0.7.3", @@ -10335,94 +10853,304 @@ } }, "node_modules/solhint": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/solhint/-/solhint-2.3.1.tgz", - "integrity": "sha512-wP/G+Dqj8LNWlCI9Mt6XiQRWQfZwv1rkZe/V+HKtip5SAZJVvp144PdH28KE45ZvR99Hhrp/Mujt74fSmXsFiw==", - "dev": true, - "dependencies": { - "ajv": "^6.6.1", - "antlr4": "4.7.1", - "chalk": "^2.4.2", - "commander": "2.18.0", - "cosmiconfig": "^5.0.7", - "eslint": "^5.6.0", - "fast-diff": "^1.1.2", - "glob": "^7.1.3", - "ignore": "^4.0.6", - "js-yaml": "^3.12.0", - "lodash": "^4.17.11", - "semver": "^6.3.0" + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.5.2.tgz", + "integrity": "sha512-o7MNYS5QPgE6l+PTGOTAUtCzo0ZLnffQsv586hntSHBe2JbSDfkoxfhAOcjZjN4OesTgaX4UEEjCjH9y/4BP5w==", + "dev": true, + "dependencies": { + "@solidity-parser/parser": "^0.18.0", + "ajv": "^6.12.6", + "antlr4": "^4.13.1-patch-1", + "ast-parents": "^0.0.1", + "chalk": "^4.1.2", + "commander": "^10.0.0", + "cosmiconfig": "^8.0.0", + "fast-diff": "^1.2.0", + "glob": "^8.0.3", + "ignore": "^5.2.4", + "js-yaml": "^4.1.0", + "latest-version": "^7.0.0", + "lodash": "^4.17.21", + "pluralize": "^8.0.0", + "semver": "^7.5.2", + "strip-ansi": "^6.0.1", + "table": "^6.8.1", + "text-table": "^0.2.0" }, "bin": { "solhint": "solhint.js" }, "optionalDependencies": { - "prettier": "^1.14.3" + "prettier": "^2.8.3" } }, - "node_modules/solhint/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/solhint/node_modules/@solidity-parser/parser": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", + "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + "dev": true + }, + "node_modules/solhint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { - "sprintf-js": "~1.0.2" + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/solhint/node_modules/commander": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", - "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "node_modules/solhint/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/solhint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/solhint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/solhint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/solhint/node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "node_modules/solhint/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/solhint/node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/solhint/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/solhint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/solhint/node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/solhint/node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/solhint/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/solhint/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/solhint/node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/solhint/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "optional": true, "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "prettier": "bin-prettier.js" }, "engines": { - "node": ">=4" + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/solhint/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "node_modules/solhint/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, "engines": { - "node": ">= 4" + "node": ">=4" } }, - "node_modules/solhint/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "node_modules/solhint/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "lru-cache": "^6.0.0" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, - "node_modules/solhint/node_modules/prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "node_modules/solhint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/solhint/node_modules/typescript": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", "dev": true, "optional": true, + "peer": true, "bin": { - "prettier": "bin-prettier.js" + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4" + "node": ">=14.17" } }, + "node_modules/solhint/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/solidity-ast": { "version": "0.4.38", "resolved": "https://registry.npmjs.org/solidity-ast/-/solidity-ast-0.4.38.tgz", @@ -10430,9 +11158,9 @@ "dev": true }, "node_modules/solidity-comments-extractor": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz", - "integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz", + "integrity": "sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==", "dev": true }, "node_modules/solidity-coverage": { @@ -11297,11 +12025,10 @@ } }, "node_modules/table": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", - "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", + "integrity": "sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==", "dev": true, - "peer": true, "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -11351,7 +12078,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -11367,8 +12093,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "peer": true + "dev": true }, "node_modules/tar": { "version": "4.4.19", @@ -11881,6 +12606,21 @@ "node": ">=10" } }, + "node_modules/typechain/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -14122,6 +14862,79 @@ "dev": true, "requires": { "solhint": "^2.0.0" + }, + "dependencies": { + "antlr4": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.7.1.tgz", + "integrity": "sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "commander": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", + "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true, + "optional": true + }, + "solhint": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-2.3.1.tgz", + "integrity": "sha512-wP/G+Dqj8LNWlCI9Mt6XiQRWQfZwv1rkZe/V+HKtip5SAZJVvp144PdH28KE45ZvR99Hhrp/Mujt74fSmXsFiw==", + "dev": true, + "requires": { + "ajv": "^6.6.1", + "antlr4": "4.7.1", + "chalk": "^2.4.2", + "commander": "2.18.0", + "cosmiconfig": "^5.0.7", + "eslint": "^5.6.0", + "fast-diff": "^1.1.2", + "glob": "^7.1.3", + "ignore": "^4.0.6", + "js-yaml": "^3.12.0", + "lodash": "^4.17.11", + "prettier": "^1.14.3", + "semver": "^6.3.0" + } + } } }, "@openzeppelin/contracts": { @@ -14283,6 +15096,32 @@ } } }, + "@pnpm/config.env-replace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", + "integrity": "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==", + "dev": true + }, + "@pnpm/network.ca-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz", + "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==", + "dev": true, + "requires": { + "graceful-fs": "4.2.10" + } + }, + "@pnpm/npm-conf": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-2.2.2.tgz", + "integrity": "sha512-UA91GwWPhFExt3IizW6bOeY/pQ0BkuNwKjk9iQW9KqxluGCrg4VenZ0/L+2Y0+ZOtme72EVvg6v0zo3AMQRCeA==", + "dev": true, + "requires": { + "@pnpm/config.env-replace": "^1.1.0", + "@pnpm/network.ca-file": "^1.0.1", + "config-chain": "^1.1.11" + } + }, "@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -14401,6 +15240,7 @@ "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.3.tgz", "integrity": "sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==", "dev": true, + "peer": true, "requires": { "antlr4ts": "^0.5.0-alpha.4" } @@ -14646,6 +15486,12 @@ "@types/node": "*" } }, + "@types/http-cache-semantics": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true + }, "@types/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", @@ -14915,16 +15761,17 @@ } }, "antlr4": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.7.1.tgz", - "integrity": "sha512-haHyTW7Y9joE5MVs37P2lNYfU2RWBLfcRDD8OWldcdZm5TiCE91B5Xl1oWSwiDUSd4rlExpt2pu1fksYQjRBYQ==", + "version": "4.13.1-patch-1", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.13.1-patch-1.tgz", + "integrity": "sha512-OjFLWWLzDMV9rdFhpvroCWR4ooktNg9/nvVYSA5z28wuVpU36QUNuioR1XLnQtcjVlf8npjyz593PxnU/f/Cow==", "dev": true }, "antlr4ts": { "version": "0.5.0-alpha.4", "resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz", "integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==", - "dev": true + "dev": true, + "peer": true }, "anymatch": { "version": "3.1.2", @@ -15041,12 +15888,17 @@ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" }, + "ast-parents": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/ast-parents/-/ast-parents-0.0.1.tgz", + "integrity": "sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==", + "dev": true + }, "astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "peer": true + "dev": true }, "async-limiter": { "version": "1.0.1", @@ -15421,6 +16273,12 @@ "resolved": "https://registry.npmjs.org/bytes32/-/bytes32-0.0.3.tgz", "integrity": "sha512-uQM5zGcelcBEk0R7vkIRVN7GnrDd2S5EeWrxv7dSFLPVoI5FwYiSYOOLaFwnsav0oSr3hZQ6mFq6QNi8Vt6n8w==" }, + "cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "dev": true + }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -15879,6 +16737,16 @@ } } }, + "config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dev": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -16038,9 +16906,9 @@ }, "dependencies": { "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true } } @@ -16593,9 +17461,9 @@ "dev": true }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true }, "slice-ansi": { @@ -16726,9 +17594,9 @@ "peer": true }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -17874,6 +18742,12 @@ "mime-types": "^2.1.12" } }, + "form-data-encoder": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", + "integrity": "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==", + "dev": true + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -18381,6 +19255,16 @@ "sshpk": "^1.7.0" } }, + "http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", + "dev": true, + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + } + }, "https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -18477,8 +19361,7 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "peer": true + "dev": true }, "inquirer": { "version": "6.5.2", @@ -18883,6 +19766,12 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", @@ -18969,6 +19858,15 @@ "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==" }, + "latest-version": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-7.0.0.tgz", + "integrity": "sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg==", + "dev": true, + "requires": { + "package-json": "^8.1.0" + } + }, "level": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", @@ -19022,6 +19920,12 @@ "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.14.tgz", "integrity": "sha512-McGS7GV/WjJ2KjfOGhJU1oJn29RYeo7Q+RpANRbUNMQ9gj5XArpbjurSuyYPTejFwbaUojstQ4XyWCrAzGOUXw==" }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -19048,8 +19952,7 @@ "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "peer": true + "dev": true }, "log-symbols": { "version": "4.1.0", @@ -19841,12 +20744,176 @@ "p-finally": "^1.0.0" } }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true + }, + "package-json": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-8.1.1.tgz", + "integrity": "sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA==", + "dev": true, + "requires": { + "got": "^12.1.0", + "registry-auth-token": "^5.0.1", + "registry-url": "^6.0.0", + "semver": "^7.3.7" + }, + "dependencies": { + "@sindresorhus/is": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dev": true, + "requires": { + "defer-to-connect": "^2.0.1" + } + }, + "cacheable-request": { + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", + "dev": true, + "requires": { + "@types/http-cache-semantics": "^4.0.2", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.3", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + } + }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true + } + } + }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "got": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", + "integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==", + "dev": true, + "requires": { + "@sindresorhus/is": "^5.2.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^10.2.8", + "decompress-response": "^6.0.0", + "form-data-encoder": "^2.1.2", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^3.0.0" + } + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "dev": true + }, + "normalize-url": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", + "dev": true + }, + "p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "dev": true + }, + "responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "dev": true, + "requires": { + "lowercase-keys": "^3.0.0" + } + }, + "semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -19940,8 +21007,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "peer": true + "dev": true }, "pathval": { "version": "1.1.1", @@ -19978,6 +21044,12 @@ "dev": true, "peer": true }, + "pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -19990,35 +21062,26 @@ "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==" }, "prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true }, "prettier-plugin-solidity": { - "version": "1.0.0-beta.24", - "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz", - "integrity": "sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.3.1.tgz", + "integrity": "sha512-MN4OP5I2gHAzHZG1wcuJl0FsLS3c4Cc5494bbg+6oQWBPuEamjwDvmGfFMZ6NFzsh3Efd9UUxeT7ImgjNH4ozA==", "dev": true, "requires": { - "@solidity-parser/parser": "^0.14.3", - "emoji-regex": "^10.1.0", - "escape-string-regexp": "^4.0.0", - "semver": "^7.3.7", - "solidity-comments-extractor": "^0.0.7", - "string-width": "^4.2.3" + "@solidity-parser/parser": "^0.17.0", + "semver": "^7.5.4", + "solidity-comments-extractor": "^0.0.8" }, "dependencies": { - "emoji-regex": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", - "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "@solidity-parser/parser": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.17.0.tgz", + "integrity": "sha512-Nko8R0/kUo391jsEHHxrGM07QFdnPGvlmox4rmH0kNiNAashItAilhy4Mv4pK5gQmW5f4sXAF58fwJbmlkGcVw==", "dev": true }, "lru-cache": { @@ -20031,9 +21094,9 @@ } }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -20094,6 +21157,12 @@ "signal-exit": "^3.0.2" } }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "dev": true + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -20167,6 +21236,12 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -20200,6 +21275,26 @@ "unpipe": "1.0.0" } }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true + } + } + }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -20273,6 +21368,24 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "registry-auth-token": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", + "integrity": "sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==", + "dev": true, + "requires": { + "@pnpm/npm-conf": "^2.1.0" + } + }, + "registry-url": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-6.0.1.tgz", + "integrity": "sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q==", + "dev": true, + "requires": { + "rc": "1.2.8" + } + }, "req-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-2.0.0.tgz", @@ -20380,6 +21493,12 @@ "path-parse": "^1.0.6" } }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, "resolve-from": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", @@ -20800,7 +21919,6 @@ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, - "peer": true, "requires": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -20812,7 +21930,6 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "peer": true, "requires": { "color-convert": "^2.0.1" } @@ -20822,7 +21939,6 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "peer": true, "requires": { "color-name": "~1.1.4" } @@ -20831,8 +21947,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "peer": true + "dev": true } } }, @@ -20884,69 +21999,208 @@ } }, "solhint": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/solhint/-/solhint-2.3.1.tgz", - "integrity": "sha512-wP/G+Dqj8LNWlCI9Mt6XiQRWQfZwv1rkZe/V+HKtip5SAZJVvp144PdH28KE45ZvR99Hhrp/Mujt74fSmXsFiw==", - "dev": true, - "requires": { - "ajv": "^6.6.1", - "antlr4": "4.7.1", - "chalk": "^2.4.2", - "commander": "2.18.0", - "cosmiconfig": "^5.0.7", - "eslint": "^5.6.0", - "fast-diff": "^1.1.2", - "glob": "^7.1.3", - "ignore": "^4.0.6", - "js-yaml": "^3.12.0", - "lodash": "^4.17.11", - "prettier": "^1.14.3", - "semver": "^6.3.0" + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/solhint/-/solhint-4.5.2.tgz", + "integrity": "sha512-o7MNYS5QPgE6l+PTGOTAUtCzo0ZLnffQsv586hntSHBe2JbSDfkoxfhAOcjZjN4OesTgaX4UEEjCjH9y/4BP5w==", + "dev": true, + "requires": { + "@solidity-parser/parser": "^0.18.0", + "ajv": "^6.12.6", + "antlr4": "^4.13.1-patch-1", + "ast-parents": "^0.0.1", + "chalk": "^4.1.2", + "commander": "^10.0.0", + "cosmiconfig": "^8.0.0", + "fast-diff": "^1.2.0", + "glob": "^8.0.3", + "ignore": "^5.2.4", + "js-yaml": "^4.1.0", + "latest-version": "^7.0.0", + "lodash": "^4.17.21", + "pluralize": "^8.0.0", + "prettier": "^2.8.3", + "semver": "^7.5.2", + "strip-ansi": "^6.0.1", + "table": "^6.8.1", + "text-table": "^0.2.0" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "@solidity-parser/parser": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.18.0.tgz", + "integrity": "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "color-convert": "^2.0.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" } }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "commander": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", - "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", "dev": true }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "requires": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + } + }, + "glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" } }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "optional": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "typescript": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", + "dev": true, + "optional": true, + "peer": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } }, @@ -20957,9 +22211,9 @@ "dev": true }, "solidity-comments-extractor": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz", - "integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz", + "integrity": "sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==", "dev": true }, "solidity-coverage": { @@ -21658,11 +22912,10 @@ } }, "table": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", - "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", + "integrity": "sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==", "dev": true, - "peer": true, "requires": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -21676,7 +22929,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dev": true, - "peer": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -21688,8 +22940,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "peer": true + "dev": true } } }, @@ -22091,6 +23342,12 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true + }, + "prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true } } }, diff --git a/package.json b/package.json index 861d8e9a..d95f7b5a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "prettier:check": "prettier --check \"(contracts|test|script)/**.sol\"", + "prettier:fix": "prettier --write \"(contracts|test|script)/**.sol\"", + "lint": "solhint -w 3 'contracts/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'" }, "repository": { "type": "git", @@ -26,9 +29,10 @@ "@typechain/hardhat": "^6.1.4", "axios": "^0.27.2", "hardhat": "^2.9.9", - "prettier": "^2.7.1", - "prettier-plugin-solidity": "^1.0.0-beta.24", - "typechain": "^8.1.1" + "prettier": "3.2.5", + "prettier-plugin-solidity": "1.3.1", + "typechain": "^8.1.1", + "solhint": "4.5.2" }, "dependencies": { "@chainlink/contracts": "^0.5.1", @@ -41,4 +45,4 @@ "get-random-values": "^2.0.0", "ssv-keys": "github:bloxapp/ssv-keys" } -} +} \ No newline at end of file diff --git a/test/foundry_tests/Auction.t.sol b/test/foundry_tests/Auction.t.sol index bcb48325..e40b5240 100644 --- a/test/foundry_tests/Auction.t.sol +++ b/test/foundry_tests/Auction.t.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/Auction.sol'; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/Auction.sol"; +import "../../contracts/StaderConfig.sol"; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract AuctionTest is Test { address staderAdmin; @@ -33,7 +33,7 @@ contract AuctionTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -43,7 +43,7 @@ contract AuctionTest is Test { vm.stopPrank(); Auction auctionImpl = new Auction(); - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ''); + TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ""); auction = Auction(address(proxy)); auction.initialize(staderAdmin, address(staderConfig)); } @@ -51,7 +51,7 @@ contract AuctionTest is Test { function test_JustToIncreaseCoverage() public { ProxyAdmin admin = new ProxyAdmin(); Auction auctionImpl = new Auction(); - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ''); + TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ""); Auction auction2 = Auction(address(proxy)); auction2.initialize(staderAdmin, address(staderConfig)); } @@ -100,11 +100,7 @@ contract AuctionTest is Test { assertFalse(ethExtracted); } - function test_addBid( - uint256 sdAmount, - uint256 u1_bid1, - uint256 u1_bid2 - ) public { + function test_addBid(uint256 sdAmount, uint256 u1_bid1, uint256 u1_bid2) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -115,24 +111,19 @@ contract AuctionTest is Test { vm.assume(u1_bid1 < auction.bidIncrement()); hoax(user1, u1_bid1); // sets user1 as next method's caller and sends u1_bid1 eth vm.expectRevert(); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); vm.assume(u1_bid2 > auction.bidIncrement()); // vm.assume(u1_bid2 + u1_bid2 < type(uint256).max ) hoax(user1, u1_bid2); - auction.addBid{value: u1_bid2}(1); + auction.addBid{ value: u1_bid2 }(1); (, , , address highestBidder, uint256 highestBidAmount, , ) = auction.lots(1); assertEq(highestBidder, user1); assertEq(highestBidAmount, u1_bid2); } // used uint128 else it will overflow - function test_addBidByAnotherUser( - uint256 sdAmount, - uint128 u1_bid1, - uint256 u2_bid1, - uint256 u2_bid2 - ) public { + function test_addBidByAnotherUser(uint256 sdAmount, uint128 u1_bid1, uint256 u2_bid1, uint256 u2_bid2) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -144,30 +135,25 @@ contract AuctionTest is Test { vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); (, , , , uint256 highestBidAmount, , ) = auction.lots(1); // used uint128, else [highestBidAmount + auction.bidIncrement()] will overflow vm.assume(u2_bid1 < highestBidAmount + auction.bidIncrement()); hoax(user2, u2_bid1); vm.expectRevert(); - auction.addBid{value: u2_bid1}(1); + auction.addBid{ value: u2_bid1 }(1); vm.assume(u2_bid2 >= highestBidAmount + auction.bidIncrement()); vm.assume(u2_bid2 < type(uint256).max - auction.bidIncrement()); // TODO: fails without this condition, not sure why hoax(user2, u2_bid2); - auction.addBid{value: u2_bid2}(1); + auction.addBid{ value: u2_bid2 }(1); (, , , address highestBidder, uint256 highestBidAmount2, , ) = auction.lots(1); assertEq(highestBidder, user2); assertEq(highestBidAmount2, u2_bid2); } - function test_userIncrementsBid( - uint128 sdAmount, - uint128 u1_bid1, - uint128 u1_bidIncrease, - uint128 u2_bid1 - ) public { + function test_userIncrementsBid(uint128 sdAmount, uint128 u1_bid1, uint128 u1_bidIncrease, uint128 u2_bid1) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -179,12 +165,12 @@ contract AuctionTest is Test { vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); (, , , , uint256 highestBidAmount, , ) = auction.lots(1); vm.assume(u2_bid1 >= highestBidAmount + auction.bidIncrement()); hoax(user2, u2_bid1); - auction.addBid{value: u2_bid1}(1); + auction.addBid{ value: u2_bid1 }(1); (, , , address highestBidder2, uint256 highestBidAmount2, , ) = auction.lots(1); assertEq(highestBidder2, user2); assertEq(highestBidAmount2, u2_bid1); @@ -193,17 +179,13 @@ contract AuctionTest is Test { uint256(u1_bid1) + uint256(u1_bidIncrease) >= uint256(highestBidAmount2) + uint256(auction.bidIncrement()) ); hoax(user1, u1_bidIncrease); - auction.addBid{value: u1_bidIncrease}(1); + auction.addBid{ value: u1_bidIncrease }(1); (, , , address highestBidder3, uint256 highestBidAmount3, , ) = auction.lots(1); assertEq(highestBidder3, user1); assertEq(highestBidAmount3, uint256(u1_bid1) + uint256(u1_bidIncrease)); } - function testFail_addBidAfterAuctionEnds( - uint256 sdAmount, - uint64 extraDuration, - uint128 u1_bid1 - ) public { + function testFail_addBidAfterAuctionEnds(uint256 sdAmount, uint64 extraDuration, uint128 u1_bid1) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -215,14 +197,10 @@ contract AuctionTest is Test { vm.roll(block.number + auction.duration() + 1 + extraDuration); // sets block.number to vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); } - function test_revertMethodsBeforeAuctionEnds( - uint256 sdAmount, - uint64 duration, - uint128 u1_bid1 - ) public { + function test_revertMethodsBeforeAuctionEnds(uint256 sdAmount, uint64 duration, uint128 u1_bid1) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -250,7 +228,7 @@ contract AuctionTest is Test { // user bids vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); vm.prank(user1); vm.expectRevert(); @@ -266,12 +244,7 @@ contract AuctionTest is Test { auction.withdrawUnselectedBid(1); } - function test_UserClaimsSD( - uint256 sdAmount, - uint64 extraDuration, - uint128 u1_bid1, - uint8 randUserSeed - ) public { + function test_UserClaimsSD(uint256 sdAmount, uint64 extraDuration, uint128 u1_bid1, uint8 randUserSeed) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -281,7 +254,7 @@ contract AuctionTest is Test { address user1 = vm.addr(1); vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); // Auction Ends vm.roll(block.number + auction.duration() + 1 + extraDuration); // sets block.number to @@ -329,7 +302,7 @@ contract AuctionTest is Test { address user1 = vm.addr(1); hoax(user1, 1 ether); - auction.addBid{value: 1 ether}(1); + auction.addBid{ value: 1 ether }(1); // set to a block after auction ends vm.roll(block.number + auction.duration() + 1 + extraDuration); @@ -350,11 +323,7 @@ contract AuctionTest is Test { auction.transferHighestBidToSSPM(1); } - function test_revert_extractNonBidSD_whenBidPlaced( - uint256 sdAmount, - uint256 bid, - uint64 duration - ) public { + function test_revert_extractNonBidSD_whenBidPlaced(uint256 sdAmount, uint256 bid, uint64 duration) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); staderToken.approve(address(auction), sdAmount); @@ -364,7 +333,7 @@ contract AuctionTest is Test { vm.assume(bid > auction.bidIncrement()); hoax(user1, bid); - auction.addBid{value: bid}(1); + auction.addBid{ value: bid }(1); vm.roll(block.number + auction.duration() + 1 + duration); @@ -394,11 +363,7 @@ contract AuctionTest is Test { auction.extractNonBidSD(1); } - function test_withdrawUnselectedBid( - uint64 duration, - uint128 u1_bid1, - uint128 u2_bid1 - ) public { + function test_withdrawUnselectedBid(uint64 duration, uint128 u1_bid1, uint128 u2_bid1) public { uint256 sdAmount = 3 ether; staderToken.approve(address(auction), sdAmount); auction.createLot(sdAmount); @@ -408,12 +373,12 @@ contract AuctionTest is Test { vm.assume(u1_bid1 > auction.bidIncrement()); hoax(user1, u1_bid1); - auction.addBid{value: u1_bid1}(1); + auction.addBid{ value: u1_bid1 }(1); (, , , , uint256 highestBidAmount, , ) = auction.lots(1); vm.assume(u2_bid1 >= highestBidAmount + auction.bidIncrement()); hoax(user2, u2_bid1); - auction.addBid{value: u2_bid1}(1); + auction.addBid{ value: u2_bid1 }(1); // Auction ends vm.roll(block.number + auction.duration() + 1 + duration); diff --git a/test/foundry_tests/ETHx.t.sol b/test/foundry_tests/ETHx.t.sol index 95fd48bb..9c65b7a1 100644 --- a/test/foundry_tests/ETHx.t.sol +++ b/test/foundry_tests/ETHx.t.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/ETHx.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/ETHx.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract ETHxTest is Test { address staderAdmin; @@ -28,7 +28,7 @@ contract ETHxTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -37,7 +37,7 @@ contract ETHxTest is Test { TransparentUpgradeableProxy ethxProxy = new TransparentUpgradeableProxy( address(ethxImpl), address(proxyAdmin), - '' + "" ); ethx = ETHx(address(ethxProxy)); ethx.initialize(staderAdmin, address(staderConfig)); @@ -54,7 +54,7 @@ contract ETHxTest is Test { TransparentUpgradeableProxy ethxProxy = new TransparentUpgradeableProxy( address(ethxImpl), address(proxyAdmin), - '' + "" ); ETHx ethx2 = ETHx(address(ethxProxy)); ethx2.initialize(staderAdmin, address(staderConfig)); @@ -69,11 +69,7 @@ contract ETHxTest is Test { assertEq(ethx.totalSupply(), 0); } - function test_mint( - uint64 randomPrivateKey, - uint64 randomPrivateKey2, - uint256 amount - ) public { + function test_mint(uint64 randomPrivateKey, uint64 randomPrivateKey2, uint256 amount) public { address minter = vm.addr(1); bytes32 MINTER_ROLE = ethx.MINTER_ROLE(); @@ -98,12 +94,7 @@ contract ETHxTest is Test { assertEq(ethx.balanceOf(randomUser2), amount); } - function test_mint( - uint64 randomPrivateKey, - uint64 randomPrivateKey2, - uint256 amount, - uint256 burnAmount - ) public { + function test_mint(uint64 randomPrivateKey, uint64 randomPrivateKey2, uint256 amount, uint256 burnAmount) public { address minter = vm.addr(1); bytes32 MINTER_ROLE = ethx.MINTER_ROLE(); diff --git a/test/foundry_tests/NodeELRewardVault.t.sol b/test/foundry_tests/NodeELRewardVault.t.sol index 9c859a66..2c9f4e2d 100644 --- a/test/foundry_tests/NodeELRewardVault.t.sol +++ b/test/foundry_tests/NodeELRewardVault.t.sol @@ -1,22 +1,27 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import { Test } from "forge-std/Test.sol"; +import { console2 } from "forge-std/console2.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/VaultProxy.sol'; -import '../../contracts/NodeELRewardVault.sol'; -import '../../contracts/OperatorRewardsCollector.sol'; -import '../../contracts/factory/VaultFactory.sol'; +import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import '../mocks/PoolUtilsMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; +import "../../contracts/library/UtilLib.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/VaultProxy.sol"; +import "../../contracts/NodeELRewardVault.sol"; +import "../../contracts/OperatorRewardsCollector.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import { SDCollateral } from "../../contracts/SDCollateral.sol"; +import { PoolUtilsMock } from "../mocks/PoolUtilsMock.sol"; +import { StakePoolManagerMock } from "../mocks/StakePoolManagerMock.sol"; +import { StaderOracleMock } from "../mocks/StaderOracleMock.sol"; +import { SDUtilityPoolMock } from "../mocks/SDUtilityPoolMock.sol"; contract NodeELRewardVaultTest is Test { + address private constant OPERATOR_ADDRESSS = address(500); address staderAdmin; address staderManager; address staderTreasury; @@ -31,12 +36,15 @@ contract NodeELRewardVaultTest is Test { VaultFactory vaultFactory; function setUp() public { + vm.clearMockedCalls(); poolId = 1; operatorId = 1; staderAdmin = vm.addr(100); staderManager = vm.addr(101); address ethDepositAddr = vm.addr(102); + address sdUtilityPoolMock = vm.addr(103); + address staderOracleMock = vm.addr(104); ProxyAdmin proxyAdmin = new ProxyAdmin(); @@ -44,34 +52,49 @@ contract NodeELRewardVaultTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); + address operator = OPERATOR_ADDRESSS; + mockStaderOracle(staderOracleMock); + mockSdUtilityPool(sdUtilityPoolMock, operator); OperatorRewardsCollector operatorRCImpl = new OperatorRewardsCollector(); TransparentUpgradeableProxy operatorRCProxy = new TransparentUpgradeableProxy( address(operatorRCImpl), address(proxyAdmin), - '' + "" ); operatorRC = OperatorRewardsCollector(address(operatorRCProxy)); operatorRC.initialize(staderAdmin, address(staderConfig)); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); NodeELRewardVault nodeELRewardVaultImpl = new NodeELRewardVault(); VaultFactory vfImpl = new VaultFactory(); - TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ''); + TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ""); vaultFactory = VaultFactory(address(vfProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); + SDCollateral collateralImpl = new SDCollateral(); + TransparentUpgradeableProxy collateralProxy = new TransparentUpgradeableProxy( + address(collateralImpl), + address(staderAdmin), + "" + ); + SDCollateral sdCollateral = SDCollateral(address(collateralProxy)); + sdCollateral.initialize(staderAdmin, address(staderConfig)); + vm.startPrank(staderAdmin); staderConfig.updateAdmin(staderAdmin); staderConfig.updateVaultFactory(address(vaultFactory)); staderConfig.updatePoolUtils(address(poolUtils)); staderConfig.updateOperatorRewardsCollector(address(operatorRC)); staderConfig.updateNodeELRewardImplementation(address(nodeELRewardVaultImpl)); + staderConfig.updateSDCollateral(address(sdCollateral)); + staderConfig.updateSDUtilityPool(sdUtilityPoolMock); + staderConfig.updateStaderOracle(staderOracleMock); staderConfig.grantRole(staderConfig.MANAGER(), staderManager); vaultFactory.grantRole(vaultFactory.NODE_REGISTRY_CONTRACT(), address(poolUtils.nodeRegistry())); vm.stopPrank(); @@ -86,7 +109,7 @@ contract NodeELRewardVaultTest is Test { TransparentUpgradeableProxy operatorRCProxy = new TransparentUpgradeableProxy( address(operatorRCImpl), address(proxyAdmin), - '' + "" ); OperatorRewardsCollector operatorRC2 = OperatorRewardsCollector(address(operatorRCProxy)); operatorRC2.initialize(staderAdmin, address(staderConfig)); @@ -113,25 +136,41 @@ contract NodeELRewardVaultTest is Test { assertEq(nodeELCloneAddr.balance, 0); hoax(randomEOA, amount); // provides amount eth to user and makes it the caller for next call - (bool success, ) = nodeELCloneAddr.call{value: amount}(''); + (bool success, ) = nodeELCloneAddr.call{ value: amount }(""); assertTrue(success); assertEq(nodeELCloneAddr.balance, amount); } - // NOTE: used uint128 to avoid arithmetic underflow overflow in calculateRewardShare - function test_withdraw(uint128 rewardEth) public { + function testNotEnoughRewardToWithdraw() public { assertEq(nodeELCloneAddr.balance, 0); vm.expectRevert(INodeELRewardVault.NotEnoughRewardToWithdraw.selector); INodeELRewardVault(nodeELCloneAddr).withdraw(); + } + + function testSDUtilityPoolMock() public { + address sdUtilityPoolMock = staderConfig.getSDUtilityPool(); + address operator = OPERATOR_ADDRESSS; + ISDUtilityPool sdUtilityPool = ISDUtilityPool(sdUtilityPoolMock); + UserData memory userData = sdUtilityPool.getUserData(operator); + assertEq(userData.totalInterestSD, 64); + assertEq(userData.totalCollateralInEth, 1024); + assertEq(userData.healthFactor, 1); + assertEq(userData.lockedEth, 0); + } + // NOTE: used uint128 to avoid arithmetic underflow overflow in calculateRewardShare + function test_withdraw(uint128 rewardEth) public { vm.assume(rewardEth > 0); + console2.log("rewardEth", rewardEth); + + assertEq(nodeELCloneAddr.balance, 0); vm.deal(nodeELCloneAddr, rewardEth); // send rewardEth to nodeELRewardVault StakePoolManagerMock sspm = new StakePoolManagerMock(); address treasury = vm.addr(3); - address operator = address(500); - address opRewardAddr = vm.addr(4); + address opRewardAddr = poolUtils.nodeRegistry().getOperatorRewardAddress(operatorId); + console2.log("opRewardAddr", opRewardAddr); vm.prank(staderAdmin); staderConfig.updateStakePoolManager(address(sspm)); @@ -139,6 +178,7 @@ contract NodeELRewardVaultTest is Test { vm.prank(staderManager); staderConfig.updateStaderTreasury(treasury); + address operator = OPERATOR_ADDRESSS; assertEq(nodeELCloneAddr.balance, rewardEth); assertEq(operatorRC.balances(operator), 0); @@ -158,13 +198,23 @@ contract NodeELRewardVaultTest is Test { // claim by operator vm.mockCall( address(poolUtils.nodeRegistry()), - abi.encodeWithSelector(INodeRegistry.getOperatorRewardAddress.selector), + abi.encodeWithSelector(INodeRegistry.getOperatorRewardAddress.selector, operator), abi.encode(opRewardAddr) ); + address sdUtilityPoolMock = staderConfig.getSDUtilityPool(); + vm.mockCall( + sdUtilityPoolMock, + abi.encodeWithSelector(ISDUtilityPool.getUserData.selector, operator), + abi.encode(UserData(64, operatorShare + 1, 1, 0)) + ); vm.prank(operator); operatorRC.claim(); + console2.log("opRewardAddr", opRewardAddr); + console2.log("operatorShare", operatorShare); + console2.log("address(opRewardAddr).balance", address(opRewardAddr).balance); + assertEq(address(opRewardAddr).balance, operatorShare); assertEq(operatorRC.balances(operator), 0); } @@ -185,4 +235,34 @@ contract NodeELRewardVaultTest is Test { VaultProxy(nodeELCloneAddr).updateOwner(); assertEq(VaultProxy(nodeELCloneAddr).owner(), vm.addr(203)); } + + function mockSdUtilityPool(address sdUtilityPoolMock, address _operator) private { + emit log_named_address("sdUtilityPoolMock", sdUtilityPoolMock); + emit log_named_address("operator account", _operator); + SDUtilityPoolMock implementation = new SDUtilityPoolMock(); + bytes memory mockCode = address(implementation).code; + vm.etch(sdUtilityPoolMock, mockCode); + vm.mockCall( + sdUtilityPoolMock, + abi.encodeWithSelector(ISDUtilityPool.getOperatorLiquidation.selector, _operator), + abi.encode(OperatorLiquidation(0, 0, 0, false, false, address(0x0))) + ); + vm.mockCall( + sdUtilityPoolMock, + abi.encodeWithSelector(ISDUtilityPool.getLiquidationThreshold.selector), + abi.encode(50) + ); + vm.mockCall( + sdUtilityPoolMock, + abi.encodeWithSelector(ISDUtilityPool.getUserData.selector, _operator), + abi.encode(UserData(64, 1024, 1, 0)) + ); + } + + function mockStaderOracle(address staderOracleMock) private { + emit log_named_address("staderOracleMock", staderOracleMock); + StaderOracleMock implementation = new StaderOracleMock(); + bytes memory mockCode = address(implementation).code; + vm.etch(staderOracleMock, mockCode); + } } diff --git a/test/foundry_tests/OperatorRewardsCollector.t.sol b/test/foundry_tests/OperatorRewardsCollector.t.sol index 28e9ff06..47c20a35 100644 --- a/test/foundry_tests/OperatorRewardsCollector.t.sol +++ b/test/foundry_tests/OperatorRewardsCollector.t.sol @@ -1,23 +1,26 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/SDUtilityPool.sol'; -import '../../contracts/SDIncentiveController.sol'; -import '../../contracts/OperatorRewardsCollector.sol'; +import { Test } from "forge-std/Test.sol"; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/SDIncentiveControllerMock.sol'; -import '../mocks/PoolUtilsMock.sol'; -import '../mocks/StaderOracleMock.sol'; -import '../mocks/WETHMock.sol'; +import "../../contracts/library/UtilLib.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/SDUtilityPool.sol"; +import "../../contracts/SDIncentiveController.sol"; +import "../../contracts/OperatorRewardsCollector.sol"; + +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/SDIncentiveControllerMock.sol"; +import "../mocks/PoolUtilsMock.sol"; +import "../mocks/StaderOracleMock.sol"; +import "../mocks/WETHMock.sol"; + +import { PermissionlessNodeRegistryMock } from "../mocks/PermissionlessNodeRegistryMock.sol"; contract OperatorRewardsCollectorTest is Test { event UpdatedStaderConfig(address indexed staderConfig); @@ -36,47 +39,49 @@ contract OperatorRewardsCollectorTest is Test { SDIncentiveController sdIncentiveController; OperatorRewardsCollector operatorRewardsCollector; StaderTokenMock staderToken; - SDCollateralMock sdCollateral; StaderOracleMock staderOracle; PoolUtilsMock poolUtils; WETHMock weth; - function setupAddresses() private { + address private sdCollateralMock; + address private permissionlessNodeRegistryMock; + + function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); staderTreasury = vm.addr(105); - } - - function setupMocks() private { staderToken = new StaderTokenMock(); weth = new WETHMock(); - sdCollateral = new SDCollateralMock(); staderOracle = new StaderOracleMock(); - } - function setUp() public { - setupAddresses(); - setupMocks(); + sdCollateralMock = vm.addr(106); + mockSDCollateral(sdCollateralMock); + + permissionlessNodeRegistryMock = vm.addr(107); + mockPermissionlessNodeRegistry(permissionlessNodeRegistryMock); address ethDepositAddr = vm.addr(102); + address operator = address(500); + ProxyAdmin admin = new ProxyAdmin(); StaderConfig configImpl = new StaderConfig(); TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); - sdCollateral = new SDCollateralMock(); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); vm.startPrank(staderAdmin); staderConfig.updateStaderToken(address(staderToken)); - staderConfig.updateSDCollateral(address(sdCollateral)); + staderConfig.updateSDCollateral(sdCollateralMock); staderConfig.updatePoolUtils(address(poolUtils)); + staderConfig.updatePermissionlessNodeRegistry(permissionlessNodeRegistryMock); staderConfig.grantRole(staderConfig.MANAGER(), staderManager); vm.stopPrank(); @@ -87,7 +92,7 @@ contract OperatorRewardsCollectorTest is Test { TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( address(sdUtilityPoolImpl), address(admin), - '' + "" ); sdUtilityPool = SDUtilityPool(address(proxy)); staderToken.approve(address(sdUtilityPool), 1000 ether); @@ -98,7 +103,7 @@ contract OperatorRewardsCollectorTest is Test { TransparentUpgradeableProxy sdIncentiveControllerProxy = new TransparentUpgradeableProxy( address(sdIncentiveControllerImpl), address(admin), - '' + "" ); sdIncentiveController = SDIncentiveController(address(sdIncentiveControllerProxy)); sdIncentiveController.initialize(staderAdmin, address(staderConfig)); @@ -107,7 +112,7 @@ contract OperatorRewardsCollectorTest is Test { TransparentUpgradeableProxy operatorRewardsCollectorProxy = new TransparentUpgradeableProxy( address(operatorRewardsCollectorImpl), address(admin), - '' + "" ); operatorRewardsCollector = OperatorRewardsCollector(address(operatorRewardsCollectorProxy)); operatorRewardsCollector.initialize(staderAdmin, address(staderConfig)); @@ -125,7 +130,7 @@ contract OperatorRewardsCollectorTest is Test { TransparentUpgradeableProxy operatorRewardsCollectorProxy = new TransparentUpgradeableProxy( address(operatorRewardsCollectorImpl), address(admin), - '' + "" ); operatorRewardsCollector = OperatorRewardsCollector(address(operatorRewardsCollectorProxy)); vm.expectEmit(); @@ -143,19 +148,19 @@ contract OperatorRewardsCollectorTest is Test { vm.expectEmit(true, true, true, true, address(operatorRewardsCollector)); emit DepositedFor(address(this), staderManager, amount); - operatorRewardsCollector.depositFor{value: amount}(staderManager); + operatorRewardsCollector.depositFor{ value: amount }(staderManager); assertEq(operatorRewardsCollector.balances(staderManager), amount); vm.expectEmit(true, true, true, true, address(operatorRewardsCollector)); emit DepositedFor(address(this), staderManager, 0 ether); - operatorRewardsCollector.depositFor{value: 0 ether}(staderManager); + operatorRewardsCollector.depositFor{ value: 0 ether }(staderManager); assertEq(operatorRewardsCollector.balances(staderManager), amount); } function test_Claim(uint256 amount) public { vm.assume(amount < 100000 ether); - operatorRewardsCollector.depositFor{value: amount}(staderManager); + operatorRewardsCollector.depositFor{ value: amount }(staderManager); assertEq(operatorRewardsCollector.balances(staderManager), amount); vm.mockCall( address(staderOracle), @@ -171,21 +176,20 @@ contract OperatorRewardsCollectorTest is Test { function test_claimLiquidationZeroAmount(uint256 amount) public { vm.assume(amount < 100000 ether); - operatorRewardsCollector.depositFor{value: amount}(staderManager); + operatorRewardsCollector.depositFor{ value: amount }(staderManager); assertEq(operatorRewardsCollector.balances(staderManager), amount); operatorRewardsCollector.claimLiquidation(staderManager); assertEq(operatorRewardsCollector.balances(staderManager), amount); } - function test_claimLiquidation(uint16 randomSeed) public { - vm.assume(randomSeed > 1); + function test_claimLiquidation() public { uint256 utilizeAmount = 1e22; - address operator = vm.addr(randomSeed); - address liquidator = vm.addr(randomSeed - 1); + address operator = vm.addr(110); + address liquidator = vm.addr(109); - operatorRewardsCollector.depositFor{value: 100 ether}(operator); + operatorRewardsCollector.depositFor{ value: 100 ether }(operator); assertEq(operatorRewardsCollector.balances(operator), 100 ether); staderToken.approve(address(sdUtilityPool), utilizeAmount * 10); @@ -196,7 +200,7 @@ contract OperatorRewardsCollectorTest is Test { vm.stopPrank(); vm.mockCall( - address(sdCollateral), + sdCollateralMock, abi.encodeWithSelector(ISDCollateral.operatorUtilizedSDBalance.selector), abi.encode(utilizeAmount) ); @@ -227,14 +231,13 @@ contract OperatorRewardsCollectorTest is Test { vm.stopPrank(); } - function test_claimLiquidationLastValidator(uint16 randomSeed) public { - vm.assume(randomSeed > 1); - uint256 utilizeAmount = 1e22; + function test_claimLiquidationLastValidator() public { + uint256 utilizeAmount = 1e4 ether; - address operator = vm.addr(randomSeed); - address liquidator = vm.addr(randomSeed - 1); + address operator = address(2); + address liquidator = vm.addr(109); - operatorRewardsCollector.depositFor{value: 100 ether}(operator); + operatorRewardsCollector.depositFor{ value: 100 ether }(operator); assertEq(operatorRewardsCollector.balances(operator), 100 ether); staderToken.approve(address(sdUtilityPool), utilizeAmount * 10); @@ -245,16 +248,15 @@ contract OperatorRewardsCollectorTest is Test { vm.stopPrank(); vm.mockCall( - address(sdCollateral), + sdCollateralMock, abi.encodeWithSelector(ISDCollateral.operatorUtilizedSDBalance.selector), abi.encode(utilizeAmount) ); vm.mockCall( - address(sdCollateral), + sdCollateralMock, abi.encodeWithSelector(ISDCollateral.getOperatorInfo.selector), abi.encode(0, 0, 0) ); - vm.mockCall( address(staderOracle), abi.encodeWithSelector(IStaderOracle.getSDPriceInETH.selector), @@ -275,24 +277,22 @@ contract OperatorRewardsCollectorTest is Test { operatorRewardsCollector.claimLiquidation(operator); assertEq(operatorRewardsCollector.balances(operator), 100 ether - operatorLiquidation.totalAmountInEth); + userData = sdUtilityPool.getUserData(operator); vm.startPrank(operator); vm.expectEmit(); - emit SDRepaid(operator, utilizeAmount); - vm.expectEmit(); - emit SDWithdrawn(operator, utilizeAmount); + emit Claimed(operator, userData.totalCollateralInEth); operatorRewardsCollector.claim(); assertEq(operatorRewardsCollector.balances(operator), 0); vm.stopPrank(); } - function test_claimAfterLiquidation(uint16 randomSeed) public { - vm.assume(randomSeed > 1); + function test_claimAfterLiquidation() public { uint256 utilizeAmount = 1e22; - address operator = vm.addr(randomSeed); - address liquidator = vm.addr(randomSeed - 1); + address operator = address(2); + address liquidator = vm.addr(109); - operatorRewardsCollector.depositFor{value: 100 ether}(operator); + operatorRewardsCollector.depositFor{ value: 100 ether }(operator); assertEq(operatorRewardsCollector.balances(operator), 100 ether); staderToken.approve(address(sdUtilityPool), utilizeAmount * 10); @@ -303,11 +303,10 @@ contract OperatorRewardsCollectorTest is Test { vm.stopPrank(); vm.mockCall( - address(sdCollateral), + sdCollateralMock, abi.encodeWithSelector(ISDCollateral.operatorUtilizedSDBalance.selector), abi.encode(utilizeAmount) ); - vm.mockCall( address(staderOracle), abi.encodeWithSelector(IStaderOracle.getSDPriceInETH.selector), @@ -339,14 +338,14 @@ contract OperatorRewardsCollectorTest is Test { function test_FullDepositWithdrawalCycle() public { uint256 depositAmount = 50 ether; - operatorRewardsCollector.depositFor{value: depositAmount}(staderManager); + operatorRewardsCollector.depositFor{ value: depositAmount }(staderManager); // Simulate some earnings vm.roll(block.number + 100); vm.startPrank(staderManager); operatorRewardsCollector.claim(); - assertEq(operatorRewardsCollector.balances(staderManager), 0 ether, 'Balance should be zero after claim'); + assertEq(operatorRewardsCollector.balances(staderManager), 0 ether, "Balance should be zero after claim"); vm.stopPrank(); } @@ -356,17 +355,17 @@ contract OperatorRewardsCollectorTest is Test { uint256 depositAmount1 = 30 ether; uint256 depositAmount2 = 40 ether; - operatorRewardsCollector.depositFor{value: depositAmount1}(operator1); - operatorRewardsCollector.depositFor{value: depositAmount2}(operator2); + operatorRewardsCollector.depositFor{ value: depositAmount1 }(operator1); + operatorRewardsCollector.depositFor{ value: depositAmount2 }(operator2); vm.startPrank(operator1); operatorRewardsCollector.claim(); - assertEq(operatorRewardsCollector.balances(operator1), 0 ether, 'Operator1 balance should be zero after claim'); + assertEq(operatorRewardsCollector.balances(operator1), 0 ether, "Operator1 balance should be zero after claim"); vm.stopPrank(); vm.startPrank(operator2); operatorRewardsCollector.claim(); - assertEq(operatorRewardsCollector.balances(operator2), 0 ether, 'Operator2 balance should be zero after claim'); + assertEq(operatorRewardsCollector.balances(operator2), 0 ether, "Operator2 balance should be zero after claim"); vm.stopPrank(); } @@ -375,7 +374,7 @@ contract OperatorRewardsCollectorTest is Test { vm.startPrank(staderAdmin); operatorRewardsCollector.updateWethAddress(newWethAddress); - assertEq(address(operatorRewardsCollector.weth()), newWethAddress, 'WETH address should be updated'); + assertEq(address(operatorRewardsCollector.weth()), newWethAddress, "WETH address should be updated"); vm.stopPrank(); // Test for unauthorized access @@ -383,23 +382,23 @@ contract OperatorRewardsCollectorTest is Test { address newWethAddress2 = vm.addr(111); vm.startPrank(unauthorizedUser); vm.expectRevert( - 'AccessControl: account 0xb961768b578514debf079017ff78c47b0a6adbf6 is missing role 0x0000000000000000000000000000000000000000000000000000000000000000' + "AccessControl: account 0xb961768b578514debf079017ff78c47b0a6adbf6 is missing role 0x0000000000000000000000000000000000000000000000000000000000000000" ); operatorRewardsCollector.updateWethAddress(newWethAddress2); vm.stopPrank(); - assertNotEq(address(operatorRewardsCollector.weth()), newWethAddress2, 'WETH address should not be updated'); + assertNotEq(address(operatorRewardsCollector.weth()), newWethAddress2, "WETH address should not be updated"); } function test_MultipleDepositsAndTotalBalance(uint256 amount1, uint256 amount2) public { vm.assume(amount1 < 1000e18 && amount2 < 1000e18); - operatorRewardsCollector.depositFor{value: amount1}(staderManager); - operatorRewardsCollector.depositFor{value: amount2}(staderManager); + operatorRewardsCollector.depositFor{ value: amount1 }(staderManager); + operatorRewardsCollector.depositFor{ value: amount2 }(staderManager); assertEq( operatorRewardsCollector.balances(staderManager), amount1 + amount2, - 'Total balance should be the sum of all deposits' + "Total balance should be the sum of all deposits" ); } @@ -414,4 +413,18 @@ contract OperatorRewardsCollectorTest is Test { operatorRewardsCollector.updateStaderConfig(inputAddr); assertEq(address(operatorRewardsCollector.staderConfig()), inputAddr); } + + function mockSDCollateral(address _sdCollateralMock) private { + emit log_named_address("sdCollateralMock", _sdCollateralMock); + SDCollateralMock sdCollateralMockImpl = new SDCollateralMock(); + bytes memory mockCode = address(sdCollateralMockImpl).code; + vm.etch(_sdCollateralMock, mockCode); + } + + function mockPermissionlessNodeRegistry(address _permissionlessNodeRegistry) private { + emit log_named_address("permissionlessNodeRegistry", _permissionlessNodeRegistry); + PermissionlessNodeRegistryMock nodeRegistryMock = new PermissionlessNodeRegistryMock(); + bytes memory mockCode = address(nodeRegistryMock).code; + vm.etch(_permissionlessNodeRegistry, mockCode); + } } diff --git a/test/foundry_tests/Penalty.t.sol b/test/foundry_tests/Penalty.t.sol index 27757c92..60ac9df2 100644 --- a/test/foundry_tests/Penalty.t.sol +++ b/test/foundry_tests/Penalty.t.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/interfaces/IRatedV1.sol'; +import "../../contracts/interfaces/IRatedV1.sol"; -import '../../contracts/Penalty.sol'; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/Penalty.sol"; +import "../../contracts/StaderConfig.sol"; -import '../mocks//PoolUtilsMock.sol'; -import '../mocks//StaderOracleMock.sol'; +import "../mocks//PoolUtilsMock.sol"; +import "../mocks//StaderOracleMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PenaltyTest is Test { address staderAdmin; @@ -27,10 +27,12 @@ contract PenaltyTest is Test { StaderOracleMock staderOracle; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); rated = vm.addr(200); address ethDepositAddr = vm.addr(102); + address operator = address(500); proxyAdmin = new ProxyAdmin(); @@ -38,7 +40,7 @@ contract PenaltyTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -47,12 +49,12 @@ contract PenaltyTest is Test { TransparentUpgradeableProxy penaltyProxy = new TransparentUpgradeableProxy( address(penaltyImpl), address(proxyAdmin), - '' + "" ); penaltyContract = Penalty(address(penaltyProxy)); penaltyContract.initialize(staderAdmin, address(staderConfig), rated); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); staderOracle = new StaderOracleMock(); vm.startPrank(staderAdmin); @@ -68,7 +70,7 @@ contract PenaltyTest is Test { TransparentUpgradeableProxy penaltyProxy = new TransparentUpgradeableProxy( address(penaltyImpl), address(proxyAdmin), - '' + "" ); Penalty penaltyContract2 = Penalty(address(penaltyProxy)); penaltyContract2.initialize(staderAdmin, address(staderConfig), rated); @@ -85,11 +87,7 @@ contract PenaltyTest is Test { UtilLib.onlyManagerRole(staderManager, staderConfig); } - function test_additionalPenaltyAmount( - address anyone, - uint256 amount, - bytes memory pubkey - ) public { + function test_additionalPenaltyAmount(address anyone, uint256 amount, bytes memory pubkey) public { vm.assume(anyone != address(0) && anyone != address(proxyAdmin) && anyone != staderManager); vm.expectRevert(UtilLib.CallerNotManager.selector); @@ -120,9 +118,10 @@ contract PenaltyTest is Test { assertEq(penaltyContract.mevTheftPenaltyPerStrike(), _mevTheftPenaltyPerStrike); } - function test_updateMissedAttestationPenaltyPerStrike(address anyone, uint256 _missedAttestationPenaltyPerStrike) - public - { + function test_updateMissedAttestationPenaltyPerStrike( + address anyone, + uint256 _missedAttestationPenaltyPerStrike + ) public { vm.assume(anyone != address(0) && anyone != address(proxyAdmin) && anyone != staderManager); vm.expectRevert(UtilLib.CallerNotManager.selector); @@ -176,7 +175,7 @@ contract PenaltyTest is Test { } function test_calculateMEVTheftPenalty() public { - bytes32 pubkeyRoot = keccak256('sample_pubkey_root'); + bytes32 pubkeyRoot = keccak256("sample_pubkey_root"); uint256[] memory mockViolatedEpochs = new uint256[](1); vm.mockCall( @@ -196,7 +195,7 @@ contract PenaltyTest is Test { } function test_calculateMissedAttestationPenalty() public { - bytes32 pubkeyRoot = keccak256('sample_pubkey_root'); + bytes32 pubkeyRoot = keccak256("sample_pubkey_root"); vm.mockCall( address(staderOracle), @@ -211,7 +210,7 @@ contract PenaltyTest is Test { function test_updateTotalPenaltyAmount() public { bytes[] memory pubkeys = new bytes[](1); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; vm.mockCall(address(poolUtils), abi.encodeWithSelector(IPoolUtils.getValidatorPoolId.selector), abi.encode(1)); vm.mockCall( diff --git a/test/foundry_tests/PermissionedNodeRegistry.t.sol b/test/foundry_tests/PermissionedNodeRegistry.t.sol index 4ea53de7..8f086d19 100644 --- a/test/foundry_tests/PermissionedNodeRegistry.t.sol +++ b/test/foundry_tests/PermissionedNodeRegistry.t.sol @@ -1,27 +1,27 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; - -import '../../contracts/StaderConfig.sol'; -import '../../contracts/factory/VaultFactory.sol'; -import '../../contracts/NodeELRewardVault.sol'; -import '../../contracts/PermissionedNodeRegistry.sol'; - -import '../mocks/PenaltyMock.sol'; -import '../mocks/SocializingPoolMock.sol'; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StaderOracleMock.sol'; -import '../mocks/PermissionedPoolMock.sol'; -import '../mocks/StaderInsuranceFundMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/OperatorRewardsCollectorMock.sol'; -import '../mocks/PoolUtilsMockForDepositFlow.sol'; - -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "../../contracts/library/UtilLib.sol"; + +import "../../contracts/StaderConfig.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import "../../contracts/NodeELRewardVault.sol"; +import "../../contracts/PermissionedNodeRegistry.sol"; + +import "../mocks/PenaltyMock.sol"; +import "../mocks/SocializingPoolMock.sol"; +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StaderOracleMock.sol"; +import "../mocks/PermissionedPoolMock.sol"; +import "../mocks/StaderInsuranceFundMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; +import "../mocks/OperatorRewardsCollectorMock.sol"; +import "../mocks/PoolUtilsMockForDepositFlow.sol"; + +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PermissionedNodeRegistryTest is Test { address staderAdmin; @@ -40,6 +40,7 @@ contract PermissionedNodeRegistryTest is Test { PermissionedPoolMock permissionedPool; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -60,13 +61,13 @@ contract PermissionedNodeRegistryTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); VaultFactory vaultImp = new VaultFactory(); - TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ''); + TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ""); vaultFactory = VaultFactory(address(vaultProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -75,7 +76,7 @@ contract PermissionedNodeRegistryTest is Test { TransparentUpgradeableProxy nodeRegistryProxy = new TransparentUpgradeableProxy( address(nodeRegistryImpl), address(admin), - '' + "" ); permissionedPool = new PermissionedPoolMock(address(staderConfig)); nodeRegistry = PermissionedNodeRegistry(address(nodeRegistryProxy)); @@ -110,7 +111,7 @@ contract PermissionedNodeRegistryTest is Test { TransparentUpgradeableProxy nodeRegistryProxy = new TransparentUpgradeableProxy( address(nodeRegistryImpl), address(admin), - '' + "" ); nodeRegistry = PermissionedNodeRegistry(address(nodeRegistryProxy)); nodeRegistry.initialize(staderAdmin, address(staderConfig)); @@ -126,11 +127,7 @@ contract PermissionedNodeRegistryTest is Test { assertTrue(nodeRegistry.hasRole(nodeRegistry.DEFAULT_ADMIN_ROLE(), staderAdmin)); } - function test_OnboardOperator( - string calldata _operatorName, - uint64 __opAddrSeed, - uint64 _opRewardAddrSeed - ) public { + function test_OnboardOperator(string calldata _operatorName, uint64 __opAddrSeed, uint64 _opRewardAddrSeed) public { vm.assume(bytes(_operatorName).length > 0 && bytes(_operatorName).length < 255); vm.assume(__opAddrSeed > 0); vm.assume(_opRewardAddrSeed > 0); @@ -206,7 +203,7 @@ contract PermissionedNodeRegistryTest is Test { nodeRegistry.pause(); whitelistOperator(operatorAddr); vm.startPrank(operatorAddr); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); nodeRegistry.onboardNodeOperator(_operatorName, opRewardAddr); vm.stopPrank(); vm.prank(staderManager); @@ -220,7 +217,7 @@ contract PermissionedNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); uint256 nextValidatorId = nodeRegistry.nextValidatorId(); @@ -234,12 +231,12 @@ contract PermissionedNodeRegistryTest is Test { bytes[] memory pubkeys = new bytes[](1); bytes[] memory preDepositSignature = new bytes[](1); bytes[] memory depositSignature = new bytes[](0); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; preDepositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); vm.expectRevert(INodeRegistry.MisMatchingInputKeysSize.selector); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); @@ -250,7 +247,7 @@ contract PermissionedNodeRegistryTest is Test { bytes[] memory preDepositSignature = new bytes[](0); bytes[] memory depositSignature = new bytes[](0); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); vm.expectRevert(INodeRegistry.InvalidKeyCount.selector); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); @@ -265,7 +262,7 @@ contract PermissionedNodeRegistryTest is Test { vm.prank(staderManager); nodeRegistry.updateMaxNonTerminalKeyPerOperator(2); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); vm.expectRevert(INodeRegistry.maxKeyLimitReached.selector); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); @@ -279,7 +276,7 @@ contract PermissionedNodeRegistryTest is Test { ) = getValidatorKeys(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); vm.mockCall( address(sdCollateral), abi.encodeWithSelector(ISDCollateral.hasEnoughSDCollateral.selector), @@ -300,9 +297,10 @@ contract PermissionedNodeRegistryTest is Test { vm.prank(operator); nodeRegistry.updateVerifiedKeysBatchSize(2); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); assertEq(nodeRegistry.getTotalQueuedValidatorCount(), pubkeys.length); + vm.stopPrank(); vm.startPrank(address(permissionedPool)); uint256 operatorId = nodeRegistry.operatorIDByAddress(permissionedNO); uint256 nextQueuedValidatorIndexBefore = nodeRegistry.nextQueuedValidatorIndexByOperatorId(operatorId); @@ -315,6 +313,7 @@ contract PermissionedNodeRegistryTest is Test { nodeRegistry.onlyPreDepositValidator(pubkeys[0]); nodeRegistry.updateQueuedValidatorIndex(operatorId, nextQueuedValidatorIndexBefore + 3); nodeRegistry.increaseTotalActiveValidatorCount(3); + vm.stopPrank(); bytes[] memory readyToDepositKeys = new bytes[](1); bytes[] memory frontRunKeys = new bytes[](1); @@ -359,7 +358,7 @@ contract PermissionedNodeRegistryTest is Test { vm.prank(operator); staderConfig.updateWithdrawnKeysBatchSize(1); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); uint256 validatorId1 = nodeRegistry.validatorIdByPubkey(pubkeys[0]); @@ -391,7 +390,7 @@ contract PermissionedNodeRegistryTest is Test { address operatorAddr = vm.addr(__opAddrSeed); whitelistOperator(operatorAddr); vm.prank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP', payable(operatorAddr)); + nodeRegistry.onboardNodeOperator("testOP", payable(operatorAddr)); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); vm.startPrank(address(permissionedPool)); nodeRegistry.updateQueuedValidatorIndex(operatorId, _nextQueuedValidatorIndex); @@ -466,7 +465,7 @@ contract PermissionedNodeRegistryTest is Test { nodeRegistry.onboardNodeOperator(_operatorName, opRewardAddr); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); - string memory newOpName = string(abi.encodePacked(_operatorName, 'test')); + string memory newOpName = string(abi.encodePacked(_operatorName, "test")); // propose new reward addr vm.expectRevert(INodeRegistry.CallerNotExistingRewardAddress.selector); @@ -513,9 +512,10 @@ contract PermissionedNodeRegistryTest is Test { nodeRegistry.proposeRewardAddress(operatorAddr, newOPRewardAddr); } - function test_updateOperatorRewardAddressWithZeroRewardAddr(string calldata _operatorName, uint64 __opAddrSeed) - public - { + function test_updateOperatorRewardAddressWithZeroRewardAddr( + string calldata _operatorName, + uint64 __opAddrSeed + ) public { vm.assume(bytes(_operatorName).length > 0 && bytes(_operatorName).length < 255); vm.assume(__opAddrSeed > 0); address operatorAddr = vm.addr(__opAddrSeed); @@ -536,7 +536,7 @@ contract PermissionedNodeRegistryTest is Test { vm.startPrank(operatorAddr); nodeRegistry.onboardNodeOperator(_operatorName, payable(operatorAddr)); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); - string memory newOpName = string(abi.encodePacked(_operatorName, 'test')); + string memory newOpName = string(abi.encodePacked(_operatorName, "test")); nodeRegistry.updateOperatorName(newOpName); (, , string memory operatorName, , ) = nodeRegistry.operatorStructById(operatorId); assertEq(operatorName, newOpName); @@ -545,7 +545,7 @@ contract PermissionedNodeRegistryTest is Test { function test_updateOperatorNameWithInActiveOperator(string calldata _operatorName) public { vm.assume(bytes(_operatorName).length > 0 && bytes(_operatorName).length < 255); - string memory newOpName = string(abi.encodePacked(_operatorName, 'test')); + string memory newOpName = string(abi.encodePacked(_operatorName, "test")); vm.expectRevert(INodeRegistry.OperatorNotOnBoarded.selector); nodeRegistry.updateOperatorName(newOpName); } @@ -557,7 +557,7 @@ contract PermissionedNodeRegistryTest is Test { whitelistOperator(operatorAddr); vm.startPrank(operatorAddr); nodeRegistry.onboardNodeOperator(_operatorName, payable(operatorAddr)); - string memory newOpName = string(abi.encodePacked('')); + string memory newOpName = string(abi.encodePacked("")); vm.expectRevert(PoolUtilsMockForDepositFlow.EmptyNameString.selector); nodeRegistry.updateOperatorName(newOpName); } @@ -593,7 +593,7 @@ contract PermissionedNodeRegistryTest is Test { ) = getValidatorKeys(); whitelistOperator(operatorAddr); vm.startPrank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP', opRewardAddr); + nodeRegistry.onboardNodeOperator("testOP", opRewardAddr); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); uint256 nonTerminalKeys = nodeRegistry.getOperatorTotalNonTerminalKeys(operatorAddr, _startIndex, _endIndex); @@ -623,7 +623,7 @@ contract PermissionedNodeRegistryTest is Test { ) = getValidatorKeys(); whitelistOperator(operatorAddr); vm.startPrank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP', opRewardAddr); + nodeRegistry.onboardNodeOperator("testOP", opRewardAddr); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.expectRevert(INodeRegistry.InvalidStartAndEndIndex.selector); nodeRegistry.getOperatorTotalNonTerminalKeys(operatorAddr, _startIndex, _endIndex); @@ -639,7 +639,7 @@ contract PermissionedNodeRegistryTest is Test { ) = getValidatorKeys(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); assertEq(nodeRegistry.getTotalQueuedValidatorCount(), pubkeys.length); @@ -671,7 +671,7 @@ contract PermissionedNodeRegistryTest is Test { ) = getValidatorKeys(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator("testOP", payable(address(this))); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); assertEq(nodeRegistry.getTotalQueuedValidatorCount(), pubkeys.length); uint256 validatorId1 = nodeRegistry.validatorIdByPubkey(pubkeys[0]); @@ -690,7 +690,7 @@ contract PermissionedNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP', payable(permissionedNO)); + nodeRegistry.onboardNodeOperator("testOP", payable(permissionedNO)); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); Validator[] memory validators = nodeRegistry.getValidatorsByOperator(permissionedNO, 1, 100); assertEq(validators.length, 3); @@ -727,12 +727,12 @@ contract PermissionedNodeRegistryTest is Test { ) = getDifferentSetOfValidatorKeys(); vm.startPrank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP1', payable(operatorAddr)); + nodeRegistry.onboardNodeOperator("testOP1", payable(operatorAddr)); nodeRegistry.addValidatorKeys(pubkeys, preDepositSignature, depositSignature); uint256 operatorId1 = nodeRegistry.operatorIDByAddress(operatorAddr); vm.stopPrank(); vm.startPrank(permissionedNO); - nodeRegistry.onboardNodeOperator('testOP2', payable(permissionedNO)); + nodeRegistry.onboardNodeOperator("testOP2", payable(permissionedNO)); nodeRegistry.addValidatorKeys(pubkeys1, preDepositSignature1, depositSignature1); uint256 operatorId2 = nodeRegistry.operatorIDByAddress(permissionedNO); vm.stopPrank(); @@ -770,7 +770,7 @@ contract PermissionedNodeRegistryTest is Test { address payable opRewardAddr = payable(vm.addr(_opRewardAddrSeed)); whitelistOperator(operatorAddr); vm.prank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP', payable(opRewardAddr)); + nodeRegistry.onboardNodeOperator("testOP", payable(opRewardAddr)); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); vm.startPrank(staderManager); nodeRegistry.deactivateNodeOperator(operatorId); @@ -785,7 +785,7 @@ contract PermissionedNodeRegistryTest is Test { address payable opRewardAddr = payable(vm.addr(_opRewardAddrSeed)); whitelistOperator(operatorAddr); vm.prank(operatorAddr); - nodeRegistry.onboardNodeOperator('testOP', opRewardAddr); + nodeRegistry.onboardNodeOperator("testOP", opRewardAddr); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); vm.startPrank(staderManager); vm.expectRevert(IPermissionedNodeRegistry.OperatorAlreadyActive.selector); @@ -806,76 +806,60 @@ contract PermissionedNodeRegistryTest is Test { nodeRegistry.whitelistPermissionedNOs(whitelistAddr); } - function getValidatorKeys() - internal - pure - returns ( - bytes[] memory, - bytes[] memory, - bytes[] memory - ) - { + function getValidatorKeys() internal pure returns (bytes[] memory, bytes[] memory, bytes[] memory) { bytes[] memory pubkeys = new bytes[](3); bytes[] memory preDepositSignature = new bytes[](3); bytes[] memory depositSignature = new bytes[](3); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkeys[1] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a'; - pubkeys[2] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518a'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkeys[1] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a"; + pubkeys[2] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518a"; preDepositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; preDepositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958"; preDepositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b"; depositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; depositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958"; depositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b"; return (pubkeys, preDepositSignature, depositSignature); } - function getDifferentSetOfValidatorKeys() - internal - pure - returns ( - bytes[] memory, - bytes[] memory, - bytes[] memory - ) - { + function getDifferentSetOfValidatorKeys() internal pure returns (bytes[] memory, bytes[] memory, bytes[] memory) { bytes[] memory pubkeys = new bytes[](3); bytes[] memory preDepositSignature = new bytes[](3); bytes[] memory depositSignature = new bytes[](3); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751'; - pubkeys[1] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6b'; - pubkeys[2] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518b'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751"; + pubkeys[1] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6b"; + pubkeys[2] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518b"; preDepositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; preDepositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849959'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849959"; preDepositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278c'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278c"; depositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; depositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849959'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849959"; depositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278c'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278c"; return (pubkeys, preDepositSignature, depositSignature); } diff --git a/test/foundry_tests/PermissionedPool.t.sol b/test/foundry_tests/PermissionedPool.t.sol index 054657e8..1bfb7238 100644 --- a/test/foundry_tests/PermissionedPool.t.sol +++ b/test/foundry_tests/PermissionedPool.t.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/factory/VaultFactory.sol'; -import '../../contracts/PermissionedPool.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import "../../contracts/PermissionedPool.sol"; -import '../mocks/ETHDepositMock.sol'; -import '../mocks/StaderInsuranceFundMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/PermissionedNodeRegistryMock.sol'; +import "../mocks/ETHDepositMock.sol"; +import "../mocks/StaderInsuranceFundMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; +import "../mocks/PermissionedNodeRegistryMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PermissionedPoolTest is Test { address staderAdmin; @@ -31,6 +31,7 @@ contract PermissionedPoolTest is Test { PermissionedNodeRegistryMock nodeRegistry; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -44,13 +45,13 @@ contract PermissionedPoolTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); VaultFactory vaultImp = new VaultFactory(); - TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ''); + TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ""); vaultFactory = VaultFactory(address(vaultProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -59,7 +60,7 @@ contract PermissionedPoolTest is Test { TransparentUpgradeableProxy permissionedPoolProxy = new TransparentUpgradeableProxy( address(permissionedPoolImpl), address(admin), - '' + "" ); nodeRegistry = new PermissionedNodeRegistryMock(); permissionedPool = PermissionedPool(payable(address(permissionedPoolProxy))); @@ -82,7 +83,7 @@ contract PermissionedPoolTest is Test { TransparentUpgradeableProxy permissionedPoolProxy = new TransparentUpgradeableProxy( address(permissionedPoolImpl), address(admin), - '' + "" ); permissionedPool = PermissionedPool(payable(address(permissionedPoolProxy))); permissionedPool.initialize(staderAdmin, address(staderConfig)); @@ -100,7 +101,7 @@ contract PermissionedPoolTest is Test { address externalEOA = vm.addr(1000); startHoax(externalEOA); vm.expectRevert(IStaderPoolBase.UnsupportedOperation.selector); - payable(permissionedPool).call{value: 1 ether}(''); + payable(permissionedPool).call{ value: 1 ether }(""); vm.stopPrank(); } @@ -108,7 +109,7 @@ contract PermissionedPoolTest is Test { address externalEOA = vm.addr(1000); startHoax(externalEOA); vm.expectRevert(IStaderPoolBase.UnsupportedOperation.selector); - payable(permissionedPool).call{value: 1 ether}('abi.encodeWithSignature("nonExistentFunction()")'); + payable(permissionedPool).call{ value: 1 ether }('abi.encodeWithSignature("nonExistentFunction()")'); vm.stopPrank(); } @@ -116,31 +117,34 @@ contract PermissionedPoolTest is Test { vm.assume(_amount > 0); vm.deal(address(this), _amount); vm.expectRevert(UtilLib.CallerNotStaderContract.selector); - permissionedPool.receiveInsuranceFund{value: _amount}(); + permissionedPool.receiveInsuranceFund{ value: _amount }(); vm.deal(address(insuranceFund), _amount); vm.prank(address(insuranceFund)); - permissionedPool.receiveInsuranceFund{value: _amount}(); + permissionedPool.receiveInsuranceFund{ value: _amount }(); assertEq(address(permissionedPool).balance, _amount); } function test_StakeUserETHToBeaconChain() public { - startHoax(address(poolManager)); + address manager = address(poolManager); + vm.startPrank(manager); + vm.deal(manager, 200 ether); vm.mockCall( address(nodeRegistry), abi.encodeWithSelector(INodeRegistry.validatorRegistry.selector), abi.encode( ValidatorStatus.INITIALIZED, - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751', - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6', - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6', + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751", + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6", + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6", address(this), 1, 150, 150 ) ); - permissionedPool.stakeUserETHToBeaconChain{value: 64 ether}(); - permissionedPool.stakeUserETHToBeaconChain{value: 64 ether}(); + permissionedPool.stakeUserETHToBeaconChain{ value: 64 ether }(); + permissionedPool.stakeUserETHToBeaconChain{ value: 64 ether }(); + vm.stopPrank(); assertEq(address(permissionedPool).balance, 124 ether); assertEq(address(ethDepositAddr).balance, 4 ether); assertEq(permissionedPool.preDepositValidatorCount(), 4); @@ -153,8 +157,8 @@ contract PermissionedPoolTest is Test { assertEq(address(insuranceFund).balance, 48 ether); bytes[] memory pubkey = new bytes[](2); - pubkey[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[1] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkey[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[1] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; vm.prank(address(nodeRegistry)); permissionedPool.fullDepositOnBeaconChain(pubkey); assertEq(permissionedPool.preDepositValidatorCount(), 0); @@ -197,7 +201,7 @@ contract PermissionedPoolTest is Test { } function test_isExistingPubkey() public { - bytes memory pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + bytes memory pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; assertEq(permissionedPool.isExistingPubkey(pubkey), true); } @@ -215,10 +219,12 @@ contract PermissionedPoolTest is Test { assertEq(permissionedPool.operatorFee(), operatorFee); } - function test_test_setCommissionFeesWithInvalidInput(uint64 protocolFee, uint64 operatorFee) public { - vm.assume(protocolFee < permissionedPool.MAX_COMMISSION_LIMIT_BIPS()); - vm.assume(operatorFee < permissionedPool.MAX_COMMISSION_LIMIT_BIPS()); - vm.assume(protocolFee + operatorFee > permissionedPool.MAX_COMMISSION_LIMIT_BIPS()); + function test_setCommissionFeesWithInvalidInput(uint64 protocolFee, uint64 operatorFee) public { + vm.assume( + protocolFee < permissionedPool.MAX_COMMISSION_LIMIT_BIPS() && + operatorFee < permissionedPool.MAX_COMMISSION_LIMIT_BIPS() && + protocolFee + operatorFee > permissionedPool.MAX_COMMISSION_LIMIT_BIPS() + ); vm.expectRevert(IStaderPoolBase.InvalidCommission.selector); vm.prank(staderManager); permissionedPool.setCommissionFees(protocolFee, operatorFee); diff --git a/test/foundry_tests/PermissionlessNodeRegistry.t.sol b/test/foundry_tests/PermissionlessNodeRegistry.t.sol index 2bed78d4..526eb353 100644 --- a/test/foundry_tests/PermissionlessNodeRegistry.t.sol +++ b/test/foundry_tests/PermissionlessNodeRegistry.t.sol @@ -1,27 +1,27 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; - -import '../../contracts/StaderConfig.sol'; -import '../../contracts/factory/VaultFactory.sol'; -import '../../contracts/NodeELRewardVault.sol'; -import '../../contracts/PermissionlessNodeRegistry.sol'; - -import '../mocks/PenaltyMock.sol'; -import '../mocks/SocializingPoolMock.sol'; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StaderOracleMock.sol'; -import '../mocks/PermissionlessPoolMock.sol'; -import '../mocks/StaderInsuranceFundMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/OperatorRewardsCollectorMock.sol'; -import '../mocks/PoolUtilsMockForDepositFlow.sol'; - -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "../../contracts/library/UtilLib.sol"; + +import "../../contracts/StaderConfig.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import "../../contracts/NodeELRewardVault.sol"; +import "../../contracts/PermissionlessNodeRegistry.sol"; + +import "../mocks/PenaltyMock.sol"; +import "../mocks/SocializingPoolMock.sol"; +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StaderOracleMock.sol"; +import "../mocks/PermissionlessPoolMock.sol"; +import "../mocks/StaderInsuranceFundMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; +import "../mocks/OperatorRewardsCollectorMock.sol"; +import "../mocks/PoolUtilsMockForDepositFlow.sol"; + +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PermissionlessNodeRegistryTest is Test { address staderAdmin; @@ -39,6 +39,7 @@ contract PermissionlessNodeRegistryTest is Test { PermissionlessPoolMock permissionlessPool; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -59,13 +60,13 @@ contract PermissionlessNodeRegistryTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); VaultFactory vaultImp = new VaultFactory(); - TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ''); + TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ""); vaultFactory = VaultFactory(address(vaultProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -74,7 +75,7 @@ contract PermissionlessNodeRegistryTest is Test { TransparentUpgradeableProxy nodeRegistryProxy = new TransparentUpgradeableProxy( address(nodeRegistryImpl), address(admin), - '' + "" ); nodeRegistry = PermissionlessNodeRegistry(address(nodeRegistryProxy)); nodeRegistry.initialize(staderAdmin, address(staderConfig)); @@ -104,7 +105,7 @@ contract PermissionlessNodeRegistryTest is Test { TransparentUpgradeableProxy nodeRegistryProxy = new TransparentUpgradeableProxy( address(nodeRegistryImpl), address(admin), - '' + "" ); nodeRegistry = PermissionlessNodeRegistry(address(nodeRegistryProxy)); nodeRegistry.initialize(staderAdmin, address(staderConfig)); @@ -206,7 +207,7 @@ contract PermissionlessNodeRegistryTest is Test { vm.prank(staderManager); nodeRegistry.pause(); vm.startPrank(operatorAddr); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); nodeRegistry.onboardNodeOperator(false, _operatorName, opRewardAddr); vm.stopPrank(); vm.prank(staderManager); @@ -220,9 +221,9 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeysWithUtilizeSD{value: 12 ether}( - 'testReferral', + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeysWithUtilizeSD{ value: 12 ether }( + "testReferral", 0, pubkeys, preDepositSignature, @@ -243,8 +244,8 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); uint256 nextValidatorId = nodeRegistry.nextValidatorId(); assertEq(nextValidatorId, 4); @@ -257,14 +258,14 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory pubkeys = new bytes[](1); bytes[] memory preDepositSignature = new bytes[](1); bytes[] memory depositSignature = new bytes[](0); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; preDepositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); vm.expectRevert(INodeRegistry.MisMatchingInputKeysSize.selector); - nodeRegistry.addValidatorKeys{value: 4 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 4 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -273,9 +274,9 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory preDepositSignature = new bytes[](0); bytes[] memory depositSignature = new bytes[](0); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); vm.expectRevert(INodeRegistry.InvalidKeyCount.selector); - nodeRegistry.addValidatorKeys{value: 4 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 4 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -288,9 +289,9 @@ contract PermissionlessNodeRegistryTest is Test { vm.prank(staderManager); nodeRegistry.updateMaxNonTerminalKeyPerOperator(2); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); vm.expectRevert(INodeRegistry.maxKeyLimitReached.selector); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -302,9 +303,9 @@ contract PermissionlessNodeRegistryTest is Test { ) = getValidatorKeys(); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); vm.expectRevert(IPermissionlessNodeRegistry.InvalidBondEthValue.selector); - nodeRegistry.addValidatorKeys{value: 2 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 2 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -316,14 +317,14 @@ contract PermissionlessNodeRegistryTest is Test { ) = getValidatorKeys(); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); vm.mockCall( address(sdCollateral), abi.encodeWithSelector(ISDCollateral.hasEnoughSDCollateral.selector), abi.encode(false) ); vm.expectRevert(INodeRegistry.NotEnoughSDCollateral.selector); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -334,10 +335,12 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); - startHoax(operator); + vm.startPrank(operator); + vm.deal(operator, 100 ether); nodeRegistry.updateVerifiedKeysBatchSize(2); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); + vm.stopPrank(); bytes[] memory readyToDepositKeys = new bytes[](1); bytes[] memory frontRunKeys = new bytes[](1); bytes[] memory invalidSigKeys = new bytes[](1); @@ -350,12 +353,14 @@ contract PermissionlessNodeRegistryTest is Test { vm.startPrank(address(staderOracle)); vm.expectRevert(INodeRegistry.TooManyVerifiedKeysReported.selector); nodeRegistry.markValidatorReadyToDeposit(readyToDepositKeys, frontRunKeys, invalidSigKeys); + vm.stopPrank(); vm.prank(operator); nodeRegistry.updateVerifiedKeysBatchSize(50); vm.startPrank(address(staderOracle)); nodeRegistry.markValidatorReadyToDeposit(readyToDepositKeys, frontRunKeys, invalidSigKeys); vm.expectRevert(INodeRegistry.UNEXPECTED_STATUS.selector); nodeRegistry.markValidatorReadyToDeposit(readyToDepositKeys, frontRunKeys, invalidSigKeys); + vm.stopPrank(); assertEq(nodeRegistry.getTotalQueuedValidatorCount(), readyToDepositKeys.length); (ValidatorStatus readyToDepositStatus, , , , , , , ) = nodeRegistry.validatorRegistry( readyToDepositValidatorId @@ -367,7 +372,7 @@ contract PermissionlessNodeRegistryTest is Test { require(invalidSigStatus == ValidatorStatus.INVALID_SIGNATURE); startHoax(operator); vm.expectRevert(INodeRegistry.OperatorIsDeactivate.selector); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); } @@ -381,8 +386,8 @@ contract PermissionlessNodeRegistryTest is Test { vm.prank(operator); staderConfig.updateWithdrawnKeysBatchSize(1); startHoax(address(this)); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.stopPrank(); uint256 validatorId1 = nodeRegistry.validatorIdByPubkey(pubkeys[0]); uint256 validatorId2 = nodeRegistry.validatorIdByPubkey(pubkeys[1]); @@ -604,9 +609,10 @@ contract PermissionlessNodeRegistryTest is Test { nodeRegistry.proposeRewardAddress(operatorAddr, newOPRewardAddr); } - function test_updateOperatorRewardAddressWithZeroRewardAddr(string calldata _operatorName, uint64 __opAddrSeed) - public - { + function test_updateOperatorRewardAddressWithZeroRewardAddr( + string calldata _operatorName, + uint64 __opAddrSeed + ) public { vm.assume(bytes(_operatorName).length > 0 && bytes(_operatorName).length < 255); vm.assume(__opAddrSeed > 0); address operatorAddr = vm.addr(__opAddrSeed); @@ -625,7 +631,7 @@ contract PermissionlessNodeRegistryTest is Test { vm.startPrank(operatorAddr); nodeRegistry.onboardNodeOperator(false, _operatorName, payable(operatorAddr)); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); - string memory newOpName = string(abi.encodePacked(_operatorName, 'test')); + string memory newOpName = string(abi.encodePacked(_operatorName, "test")); nodeRegistry.updateOperatorName(newOpName); (, , string memory operatorName, , ) = nodeRegistry.operatorStructById(operatorId); assertEq(operatorName, newOpName); @@ -634,7 +640,7 @@ contract PermissionlessNodeRegistryTest is Test { function test_updateOperatorNameWithInActiveOperator(string calldata _operatorName) public { vm.assume(bytes(_operatorName).length > 0 && bytes(_operatorName).length < 255); - string memory newOpName = string(abi.encodePacked(_operatorName, 'test')); + string memory newOpName = string(abi.encodePacked(_operatorName, "test")); vm.expectRevert(INodeRegistry.OperatorNotOnBoarded.selector); nodeRegistry.updateOperatorName(newOpName); } @@ -645,7 +651,7 @@ contract PermissionlessNodeRegistryTest is Test { address operatorAddr = vm.addr(__opAddrSeed); vm.startPrank(operatorAddr); nodeRegistry.onboardNodeOperator(false, _operatorName, payable(operatorAddr)); - string memory newOpName = string(abi.encodePacked('')); + string memory newOpName = string(abi.encodePacked("")); vm.expectRevert(PoolUtilsMockForDepositFlow.EmptyNameString.selector); nodeRegistry.updateOperatorName(newOpName); } @@ -696,9 +702,9 @@ contract PermissionlessNodeRegistryTest is Test { ) = getValidatorKeys(); startHoax(operatorAddr); - nodeRegistry.onboardNodeOperator(true, 'testOP', opRewardAddr); + nodeRegistry.onboardNodeOperator(true, "testOP", opRewardAddr); uint256 operatorId = nodeRegistry.operatorIDByAddress(operatorAddr); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); uint256 nonTerminalKeys = nodeRegistry.getOperatorTotalNonTerminalKeys(operatorAddr, _startIndex, _endIndex); uint256 validatorCount = nodeRegistry.getOperatorTotalKeys(operatorId); uint256 expectedNonTerminalKeys = _startIndex >= pubkeys.length @@ -726,8 +732,8 @@ contract PermissionlessNodeRegistryTest is Test { ) = getValidatorKeys(); startHoax(operatorAddr); - nodeRegistry.onboardNodeOperator(true, 'testOP', opRewardAddr); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.onboardNodeOperator(true, "testOP", opRewardAddr); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); vm.expectRevert(INodeRegistry.InvalidStartAndEndIndex.selector); nodeRegistry.getOperatorTotalNonTerminalKeys(operatorAddr, _startIndex, _endIndex); } @@ -741,9 +747,11 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); - startHoax(operator); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + vm.startPrank(operator); + vm.deal(operator, 100 ether); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); + vm.stopPrank(); bytes[] memory readyToDepositKeys = new bytes[](3); bytes[] memory frontRunKeys = new bytes[](0); bytes[] memory invalidSigKeys = new bytes[](0); @@ -780,9 +788,11 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); - startHoax(operator); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(address(this))); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + vm.startPrank(operator); + vm.deal(operator, 100 ether); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this))); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); + vm.stopPrank(); bytes[] memory readyToDepositKeys = new bytes[](1); bytes[] memory frontRunKeys = new bytes[](0); bytes[] memory invalidSigKeys = new bytes[](0); @@ -807,8 +817,8 @@ contract PermissionlessNodeRegistryTest is Test { bytes[] memory depositSignature ) = getValidatorKeys(); startHoax(op); - nodeRegistry.onboardNodeOperator(true, 'testOP', payable(op)); - nodeRegistry.addValidatorKeys{value: 12 ether}(pubkeys, preDepositSignature, depositSignature); + nodeRegistry.onboardNodeOperator(true, "testOP", payable(op)); + nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature); Validator[] memory validators = nodeRegistry.getValidatorsByOperator(op, 1, 100); assertEq(validators.length, 3); // assertEq(validators[0].pubkey, pubkeys[0]); @@ -837,13 +847,13 @@ contract PermissionlessNodeRegistryTest is Test { address op3 = vm.addr(30000000); address op4 = vm.addr(40000000); vm.prank(op1); - nodeRegistry.onboardNodeOperator(false, 'op1', payable(op1)); + nodeRegistry.onboardNodeOperator(false, "op1", payable(op1)); vm.prank(op2); - nodeRegistry.onboardNodeOperator(false, 'op2', payable(op2)); + nodeRegistry.onboardNodeOperator(false, "op2", payable(op2)); vm.prank(op3); - nodeRegistry.onboardNodeOperator(false, 'op3', payable(op3)); + nodeRegistry.onboardNodeOperator(false, "op3", payable(op3)); vm.prank(op4); - nodeRegistry.onboardNodeOperator(false, 'op4', payable(op4)); + nodeRegistry.onboardNodeOperator(false, "op4", payable(op4)); address[] memory operatorAddr = nodeRegistry.getAllNodeELVaultAddress(_pageNumber, _pageSize); uint256 startIndex = (_pageNumber - 1) * _pageSize + 1; uint256 nextOperatorId = nodeRegistry.nextOperatorId(); @@ -861,13 +871,13 @@ contract PermissionlessNodeRegistryTest is Test { address op3 = vm.addr(30000000); address op4 = vm.addr(40000000); vm.prank(op1); - nodeRegistry.onboardNodeOperator(false, 'op1', payable(op1)); + nodeRegistry.onboardNodeOperator(false, "op1", payable(op1)); vm.prank(op2); - nodeRegistry.onboardNodeOperator(false, 'op2', payable(op2)); + nodeRegistry.onboardNodeOperator(false, "op2", payable(op2)); vm.prank(op3); - nodeRegistry.onboardNodeOperator(false, 'op3', payable(op3)); + nodeRegistry.onboardNodeOperator(false, "op3", payable(op3)); vm.prank(op4); - nodeRegistry.onboardNodeOperator(false, 'op4', payable(op4)); + nodeRegistry.onboardNodeOperator(false, "op4", payable(op4)); vm.expectRevert(INodeRegistry.PageNumberIsZero.selector); nodeRegistry.getAllNodeELVaultAddress(pageNumber, _pageSize); } @@ -876,39 +886,31 @@ contract PermissionlessNodeRegistryTest is Test { assertEq(nodeRegistry.getCollateralETH(), 4 ether); } - function getValidatorKeys() - internal - pure - returns ( - bytes[] memory, - bytes[] memory, - bytes[] memory - ) - { + function getValidatorKeys() internal pure returns (bytes[] memory, bytes[] memory, bytes[] memory) { bytes[] memory pubkeys = new bytes[](3); bytes[] memory preDepositSignature = new bytes[](3); bytes[] memory depositSignature = new bytes[](3); - pubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkeys[1] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a'; - pubkeys[2] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518a'; + pubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkeys[1] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a"; + pubkeys[2] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d69183518a"; preDepositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; preDepositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958"; preDepositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b"; depositSignature[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f5"; depositSignature[ 1 - ] = '0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958'; + ] = "0xa119a476cd0f30f5117b823c5732c66199136f18e55e6a616a52a69f1986d8b08055bccbf7169baf47289fa2849958"; depositSignature[ 2 - ] = '0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b'; + ] = "0x8c6c13d3cc575bd0e679481d6a730ee19e73d6918351b2d42eb77ff690664348a5060ccb8938df9cedfd2998d7278b"; return (pubkeys, preDepositSignature, depositSignature); } diff --git a/test/foundry_tests/PermissionlessPool.t.sol b/test/foundry_tests/PermissionlessPool.t.sol index 6683ed59..b0483592 100644 --- a/test/foundry_tests/PermissionlessPool.t.sol +++ b/test/foundry_tests/PermissionlessPool.t.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/factory/VaultFactory.sol'; -import '../../contracts/PermissionlessPool.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import "../../contracts/PermissionlessPool.sol"; -import '../mocks/ETHDepositMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/PermissionlessNodeRegistryMock.sol'; +import "../mocks/ETHDepositMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; +import "../mocks/PermissionlessNodeRegistryMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PermissionlessPoolTest is Test { address staderAdmin; @@ -29,6 +29,7 @@ contract PermissionlessPoolTest is Test { PermissionlessNodeRegistryMock nodeRegistry; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -41,13 +42,13 @@ contract PermissionlessPoolTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); VaultFactory vaultImp = new VaultFactory(); - TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ''); + TransparentUpgradeableProxy vaultProxy = new TransparentUpgradeableProxy(address(vaultImp), address(admin), ""); vaultFactory = VaultFactory(address(vaultProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -56,7 +57,7 @@ contract PermissionlessPoolTest is Test { TransparentUpgradeableProxy permissionlessPoolProxy = new TransparentUpgradeableProxy( address(permissionlessPoolImpl), address(admin), - '' + "" ); nodeRegistry = new PermissionlessNodeRegistryMock(); permissionlessPool = PermissionlessPool(payable(address(permissionlessPoolProxy))); @@ -78,7 +79,7 @@ contract PermissionlessPoolTest is Test { TransparentUpgradeableProxy permissionlessPoolProxy = new TransparentUpgradeableProxy( address(permissionlessPoolImpl), address(admin), - '' + "" ); permissionlessPool = PermissionlessPool(payable(address(permissionlessPoolProxy))); permissionlessPool.initialize(staderAdmin, address(staderConfig)); @@ -105,7 +106,7 @@ contract PermissionlessPoolTest is Test { address externalEOA = vm.addr(1000); startHoax(externalEOA); vm.expectRevert(IStaderPoolBase.UnsupportedOperation.selector); - payable(permissionlessPool).call{value: 1 ether}('abi.encodeWithSignature("nonExistentFunction()")'); + payable(permissionlessPool).call{ value: 1 ether }('abi.encodeWithSignature("nonExistentFunction()")'); vm.stopPrank(); } @@ -113,66 +114,66 @@ contract PermissionlessPoolTest is Test { vm.assume(_amount > 0); vm.deal(address(this), _amount); vm.expectRevert(UtilLib.CallerNotStaderContract.selector); - permissionlessPool.receiveRemainingCollateralETH{value: _amount}(); + permissionlessPool.receiveRemainingCollateralETH{ value: _amount }(); vm.deal(address(nodeRegistry), _amount); vm.prank(address(nodeRegistry)); - permissionlessPool.receiveRemainingCollateralETH{value: _amount}(); + permissionlessPool.receiveRemainingCollateralETH{ value: _amount }(); assertEq(address(permissionlessPool).balance, _amount); } function test_preDepositOnBeaconChain() public { bytes[] memory pubkey = new bytes[](2); - pubkey[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[1] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkey[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[1] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; bytes[] memory preDepositSig = new bytes[](2); preDepositSig[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; preDepositSig[ 1 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; startHoax(address(nodeRegistry), 2 ether); - permissionlessPool.preDepositOnBeaconChain{value: 2 ether}(pubkey, preDepositSig, 1, 2); + permissionlessPool.preDepositOnBeaconChain{ value: 2 ether }(pubkey, preDepositSig, 1, 2); } function testFail_preDepositOnBeaconChain() public { bytes[] memory pubkey = new bytes[](3); - pubkey[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[1] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[2] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkey[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[1] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[2] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; bytes[] memory preDepositSig = new bytes[](3); preDepositSig[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; preDepositSig[ 1 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; preDepositSig[ 2 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; startHoax(address(nodeRegistry), 3 ether); - permissionlessPool.preDepositOnBeaconChain{value: 2 ether}(pubkey, preDepositSig, 1, 2); + permissionlessPool.preDepositOnBeaconChain{ value: 2 ether }(pubkey, preDepositSig, 1, 2); } function test_preDepositOnBeaconChainWithExtraETH() public { bytes[] memory pubkey = new bytes[](2); - pubkey[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[1] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkey[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[1] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; bytes[] memory preDepositSig = new bytes[](2); preDepositSig[ 0 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; preDepositSig[ 1 - ] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + ] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; startHoax(address(nodeRegistry), 10 ether); - permissionlessPool.preDepositOnBeaconChain{value: 5 ether}(pubkey, preDepositSig, 1, 2); + permissionlessPool.preDepositOnBeaconChain{ value: 5 ether }(pubkey, preDepositSig, 1, 2); assertEq(address(permissionlessPool).balance, 3 ether); } @@ -183,9 +184,9 @@ contract PermissionlessPoolTest is Test { abi.encodeWithSelector(INodeRegistry.validatorRegistry.selector), abi.encode( ValidatorStatus.INITIALIZED, - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751', - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6', - '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6', + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336751", + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6", + "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6", address(this), 1, 150, @@ -193,7 +194,7 @@ contract PermissionlessPoolTest is Test { ) ); vm.deal(address(nodeRegistry), 50 ether); - permissionlessPool.stakeUserETHToBeaconChain{value: 112 ether}(); + permissionlessPool.stakeUserETHToBeaconChain{ value: 112 ether }(); assertEq(address(permissionlessPool).balance, 0); assertEq(address(nodeRegistry).balance, 38 ether); assertEq(address(ethDepositAddr).balance, 124 ether); @@ -224,7 +225,7 @@ contract PermissionlessPoolTest is Test { } function test_isExistingPubkey() public { - bytes memory pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + bytes memory pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; assertEq(permissionlessPool.isExistingPubkey(pubkey), true); } @@ -242,10 +243,12 @@ contract PermissionlessPoolTest is Test { assertEq(permissionlessPool.operatorFee(), operatorFee); } - function test_test_setCommissionFeesWithInvalidInput(uint64 protocolFee, uint64 operatorFee) public { - vm.assume(protocolFee < permissionlessPool.MAX_COMMISSION_LIMIT_BIPS()); - vm.assume(operatorFee < permissionlessPool.MAX_COMMISSION_LIMIT_BIPS()); - vm.assume(protocolFee + operatorFee > permissionlessPool.MAX_COMMISSION_LIMIT_BIPS()); + function test_setCommissionFeesWithInvalidInput(uint64 protocolFee, uint64 operatorFee) public { + vm.assume( + protocolFee < permissionlessPool.MAX_COMMISSION_LIMIT_BIPS() && + operatorFee < permissionlessPool.MAX_COMMISSION_LIMIT_BIPS() && + protocolFee + operatorFee > permissionlessPool.MAX_COMMISSION_LIMIT_BIPS() + ); vm.expectRevert(IStaderPoolBase.InvalidCommission.selector); vm.prank(staderManager); permissionlessPool.setCommissionFees(protocolFee, operatorFee); diff --git a/test/foundry_tests/PoolSelector.t.sol b/test/foundry_tests/PoolSelector.t.sol index 5b2f5062..baf7ef39 100644 --- a/test/foundry_tests/PoolSelector.t.sol +++ b/test/foundry_tests/PoolSelector.t.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/PoolSelector.sol'; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/PoolSelector.sol"; +import "../../contracts/StaderConfig.sol"; -import '../mocks/PoolUtilsMockForDepositFlow.sol'; +import "../mocks/PoolUtilsMockForDepositFlow.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PoolSelectorTest is Test { address staderAdmin; @@ -24,6 +24,7 @@ contract PoolSelectorTest is Test { PoolUtilsMockForDepositFlow poolUtils; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -36,7 +37,7 @@ contract PoolSelectorTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); @@ -45,7 +46,7 @@ contract PoolSelectorTest is Test { TransparentUpgradeableProxy poolSelectorProxy = new TransparentUpgradeableProxy( address(poolSelectorImp), address(admin), - '' + "" ); poolSelector = PoolSelector(address(poolSelectorProxy)); @@ -67,7 +68,7 @@ contract PoolSelectorTest is Test { TransparentUpgradeableProxy poolSelectorProxy = new TransparentUpgradeableProxy( address(poolSelectorImp), address(admin), - '' + "" ); poolSelector = PoolSelector(address(poolSelectorProxy)); diff --git a/test/foundry_tests/PoolUtils.t.sol b/test/foundry_tests/PoolUtils.t.sol index c65c4341..3c65d300 100644 --- a/test/foundry_tests/PoolUtils.t.sol +++ b/test/foundry_tests/PoolUtils.t.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/PoolUtils.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/PoolUtils.sol"; -import '../mocks/NodeRegistryMock.sol'; -import '../mocks/PoolMock.sol'; +import "../mocks/NodeRegistryMock.sol"; +import "../mocks/PoolMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract PoolUtilsTest is Test { address staderAdmin; @@ -27,12 +27,13 @@ contract PoolUtilsTest is Test { event ExitOperator(address operator, uint256 amount); function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); address ethDepositAddr = vm.addr(103); - nodeRegistry = new NodeRegistryMock(); + nodeRegistry = new NodeRegistryMock(operator); pool = new PoolMock(address(nodeRegistry)); ProxyAdmin admin = new ProxyAdmin(); @@ -41,7 +42,7 @@ contract PoolUtilsTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); @@ -50,7 +51,7 @@ contract PoolUtilsTest is Test { TransparentUpgradeableProxy poolUtilsProxy = new TransparentUpgradeableProxy( address(poolUtilsImpl), address(admin), - '' + "" ); poolUtils = PoolUtils(payable(address(poolUtilsProxy))); poolUtils.initialize(staderAdmin, address(staderConfig)); @@ -68,7 +69,7 @@ contract PoolUtilsTest is Test { TransparentUpgradeableProxy poolUtilsProxy = new TransparentUpgradeableProxy( address(poolUtilsImpl), address(admin), - '' + "" ); poolUtils = PoolUtils(payable(address(poolUtilsProxy))); poolUtils.initialize(staderAdmin, address(staderConfig)); @@ -130,8 +131,8 @@ contract PoolUtilsTest is Test { function test_processValidatorExitList() public { bytes[] memory pubkey = new bytes[](2); - pubkey[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; - pubkey[1] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + pubkey[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; + pubkey[1] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; vm.expectRevert(UtilLib.CallerNotOperator.selector); poolUtils.processValidatorExitList(pubkey); @@ -270,7 +271,7 @@ contract PoolUtilsTest is Test { } function test_isExistingPubkey() public { - bytes memory pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + bytes memory pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; assertFalse(poolUtils.isExistingPubkey(pubkey)); vm.mockCall( @@ -314,7 +315,7 @@ contract PoolUtilsTest is Test { } function test_getValidatorPoolId() public { - bytes memory pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + bytes memory pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; vm.expectRevert(IPoolUtils.PubkeyDoesNotExit.selector); poolUtils.getValidatorPoolId(pubkey); @@ -373,17 +374,17 @@ contract PoolUtilsTest is Test { } function test_onlyValidKeys() public { - bytes memory pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + bytes memory pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; bytes - memory preDepositSig = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + memory preDepositSig = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; bytes - memory depositSig = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + memory depositSig = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; - bytes memory invalidPubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5'; + bytes memory invalidPubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5"; bytes - memory invalidPreDepositSig = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad4'; + memory invalidPreDepositSig = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad4"; bytes - memory invalidDepositSig = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489e'; + memory invalidDepositSig = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489e"; vm.expectRevert(IPoolUtils.InvalidLengthOfPubkey.selector); poolUtils.onlyValidKeys(invalidPubkey, preDepositSig, depositSig); diff --git a/test/foundry_tests/SDCollateral.t.sol b/test/foundry_tests/SDCollateral.t.sol index 3bc70a04..79149cb4 100644 --- a/test/foundry_tests/SDCollateral.t.sol +++ b/test/foundry_tests/SDCollateral.t.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/Auction.sol'; -import '../../contracts/SDCollateral.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/Auction.sol"; +import "../../contracts/SDCollateral.sol"; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/PoolUtilsMock.sol'; -import '../mocks/StaderOracleMock.sol'; -import '../mocks/SDUtilityPoolMock.sol'; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/PoolUtilsMock.sol"; +import "../mocks/StaderOracleMock.sol"; +import "../mocks/SDUtilityPoolMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract SDCollateralTest is Test { address staderAdmin; @@ -29,6 +29,7 @@ contract SDCollateralTest is Test { staderAdmin = vm.addr(100); staderManager = vm.addr(101); address ethDepositAddr = vm.addr(102); + address operator = address(500); StaderOracleMock staderOracle = new StaderOracleMock(); @@ -41,15 +42,15 @@ contract SDCollateralTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); - PoolUtilsMock poolUtils = new PoolUtilsMock(address(staderConfig)); + PoolUtilsMock poolUtils = new PoolUtilsMock(address(staderConfig), operator); Auction auctionImpl = new Auction(); - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ''); + TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(auctionImpl), address(admin), ""); Auction auction = Auction(address(proxy)); auction.initialize(staderAdmin, address(staderConfig)); @@ -66,7 +67,7 @@ contract SDCollateralTest is Test { TransparentUpgradeableProxy collateralProxy = new TransparentUpgradeableProxy( address(collateralImpl), address(admin), - '' + "" ); sdCollateral = SDCollateral(address(collateralProxy)); sdCollateral.initialize(staderAdmin, address(staderConfig)); @@ -78,7 +79,7 @@ contract SDCollateralTest is Test { TransparentUpgradeableProxy collateralProxy = new TransparentUpgradeableProxy( address(collateralImpl), address(admin), - '' + "" ); SDCollateral sdCollateral2 = SDCollateral(address(collateralProxy)); sdCollateral2.initialize(staderAdmin, address(staderConfig)); @@ -102,11 +103,7 @@ contract SDCollateralTest is Test { sdCollateral.depositSDAsCollateral(sdAmount); } - function test_depositSDAsCollateral( - uint128 approveAmount, - uint128 sdAmount, - uint16 randomSeed - ) public { + function test_depositSDAsCollateral(uint128 approveAmount, uint128 sdAmount, uint16 randomSeed) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -144,7 +141,7 @@ contract SDCollateralTest is Test { vm.assume(approveAmount >= sdAmount); vm.expectRevert(UtilLib.ZeroAddress.selector); sdCollateral.depositSDAsCollateralOnBehalf(address(0), sdAmount); - vm.expectRevert('ERC20: insufficient allowance'); + vm.expectRevert("ERC20: insufficient allowance"); sdCollateral.depositSDAsCollateralOnBehalf(user2, sdAmount); staderToken.approve(address(sdCollateral), approveAmount); sdCollateral.depositSDAsCollateralOnBehalf(user2, sdAmount); @@ -153,11 +150,7 @@ contract SDCollateralTest is Test { assertEq(staderToken.balanceOf(address(sdCollateral)), sdAmount); } - function test_depositSDFromUtilityPool( - uint128 approveAmount, - uint128 sdAmount, - uint16 randomSeed - ) public { + function test_depositSDFromUtilityPool(uint128 approveAmount, uint128 sdAmount, uint16 randomSeed) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance); @@ -205,7 +198,7 @@ contract SDCollateralTest is Test { ) public { // not called by manager vm.expectRevert(UtilLib.CallerNotManager.selector); - sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, "ETH"); } function test_updatePoolThreshold_revertIfMinThresholdGTMaxThreshold( @@ -217,7 +210,7 @@ contract SDCollateralTest is Test { vm.assume(_minThreshold > _maxThreshold); vm.prank(staderManager); vm.expectRevert(ISDCollateral.InvalidPoolLimit.selector); - sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, "ETH"); } function test_updatePoolThreshold_revertIfMinThresholdGTWithdrawThreshold( @@ -229,7 +222,7 @@ contract SDCollateralTest is Test { vm.assume(_minThreshold > _withdrawThreshold); vm.prank(staderManager); vm.expectRevert(ISDCollateral.InvalidPoolLimit.selector); - sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, "ETH"); } function test_updatePoolThreshold( @@ -240,7 +233,7 @@ contract SDCollateralTest is Test { ) public { vm.assume(_minThreshold <= _maxThreshold && _minThreshold <= _withdrawThreshold); vm.prank(staderManager); - sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(_poolId, _minThreshold, _maxThreshold, _withdrawThreshold, "ETH"); (uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold, string memory units) = sdCollateral .poolThresholdbyPoolId(_poolId); @@ -248,7 +241,7 @@ contract SDCollateralTest is Test { assertEq(minThreshold, _minThreshold); assertEq(maxThreshold, _maxThreshold); assertEq(withdrawThreshold, _withdrawThreshold); - assertEq(units, 'ETH'); + assertEq(units, "ETH"); } function test_withdraw_revertIfPoolThresholdNotSet(uint256 _requestedSD) public { @@ -260,7 +253,7 @@ contract SDCollateralTest is Test { // set poolThreshold (uint8 poolId, uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold) = (1, 4e17, 2e18, 1e18); vm.prank(staderManager); - sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, "ETH"); // assuming deployer is operator uint256 deployerSDBalance = staderToken.balanceOf(address(this)); @@ -279,7 +272,7 @@ contract SDCollateralTest is Test { // set poolThreshold (uint8 poolId, uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold) = (1, 4e17, 2e18, 1e18); vm.prank(staderManager); - sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, "ETH"); // assuming deployer is operator address operator = address(this); @@ -320,7 +313,7 @@ contract SDCollateralTest is Test { function test_slashValidatorSD_auctionLotNotCreated_whenNoCollateral() public { // set poolThreshold vm.prank(staderManager); - sdCollateral.updatePoolThreshold(1, 4e17, 2e18, 1e18, 'ETH'); + sdCollateral.updatePoolThreshold(1, 4e17, 2e18, 1e18, "ETH"); address validatorWithdrawVault = address(1); // have set the same in NodeRegistryMock address operator = address(500); @@ -339,7 +332,7 @@ contract SDCollateralTest is Test { function test_slashValidatorSD() public { // set poolThreshold vm.prank(staderManager); - sdCollateral.updatePoolThreshold(1, 4e17, 2e18, 1e18, 'ETH'); + sdCollateral.updatePoolThreshold(1, 4e17, 2e18, 1e18, "ETH"); address validatorWithdrawVault = address(1); // have set the same in NodeRegistryMock address operator = address(500); @@ -359,7 +352,7 @@ contract SDCollateralTest is Test { assertEq(auction.nextLot(), 1); vm.prank(validatorWithdrawVault); - vm.expectRevert('ERC20: insufficient allowance'); + vm.expectRevert("ERC20: insufficient allowance"); sdCollateral.slashValidatorSD(1, 1); vm.prank(staderManager); @@ -427,7 +420,7 @@ contract SDCollateralTest is Test { // set PoolThreshold (uint8 poolId, uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold) = (1, 4e17, 2e18, 1e18); vm.prank(staderManager); - sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, "ETH"); staderToken.approve(address(sdCollateral), depositSDAmount); sdCollateral.depositSDAsCollateral(depositSDAmount); @@ -452,7 +445,7 @@ contract SDCollateralTest is Test { // set PoolThreshold (uint8 poolId, uint256 minThreshold, uint256 maxThreshold, uint256 withdrawThreshold) = (1, 4e17, 2e18, 1e18); vm.prank(staderManager); - sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, 'ETH'); + sdCollateral.updatePoolThreshold(poolId, minThreshold, maxThreshold, withdrawThreshold, "ETH"); staderToken.approve(address(sdCollateral), depositSDAmount); sdCollateral.depositSDAsCollateral(depositSDAmount); diff --git a/test/foundry_tests/SDIncentiveController.t.sol b/test/foundry_tests/SDIncentiveController.t.sol index eb263928..7a0f6591 100644 --- a/test/foundry_tests/SDIncentiveController.t.sol +++ b/test/foundry_tests/SDIncentiveController.t.sol @@ -1,21 +1,21 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/SDUtilityPool.sol'; -import '../../contracts/SDIncentiveController.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/SDUtilityPool.sol"; +import "../../contracts/SDIncentiveController.sol"; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/SDIncentiveControllerMock.sol'; -import '../mocks/OperatorRewardsCollectorMock.sol'; -import '../mocks/PoolUtilsMock.sol'; +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/SDIncentiveControllerMock.sol"; +import "../mocks/OperatorRewardsCollectorMock.sol"; +import "../mocks/PoolUtilsMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract SDIncentiveControllerTest is Test { event EmissionRateUpdated(uint256 newEmissionRate); @@ -49,14 +49,15 @@ contract SDIncentiveControllerTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); sdCollateral = new SDCollateralMock(); operatorRewardsCollector = new OperatorRewardsCollectorMock(); - poolUtils = new PoolUtilsMock(address(staderConfig)); + address operator = address(500); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); vm.startPrank(staderAdmin); staderConfig.updateStaderToken(address(staderToken)); @@ -73,7 +74,7 @@ contract SDIncentiveControllerTest is Test { TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( address(sdUtilityPoolImpl), address(admin), - '' + "" ); sdUtilityPool = SDUtilityPool(address(proxy)); staderToken.approve(address(sdUtilityPool), 1 ether); @@ -84,7 +85,7 @@ contract SDIncentiveControllerTest is Test { TransparentUpgradeableProxy sdIncentiveControllerProxy = new TransparentUpgradeableProxy( address(sdIncentiveControllerImpl), address(admin), - '' + "" ); sdIncentiveController = SDIncentiveController(address(sdIncentiveControllerProxy)); sdIncentiveController.initialize(staderAdmin, address(staderConfig)); @@ -99,7 +100,7 @@ contract SDIncentiveControllerTest is Test { TransparentUpgradeableProxy sdIncentiveControllerProxy = new TransparentUpgradeableProxy( address(sdIncentiveControllerImpl), address(admin), - '' + "" ); SDIncentiveController sdIncentiveController2 = SDIncentiveController(address(sdIncentiveControllerProxy)); @@ -243,11 +244,7 @@ contract SDIncentiveControllerTest is Test { assertEq(earned + sdIncentiveController.earned(user2) + sdIncentiveController.earned(user), preEarned); } - function testWithdrawMultiples( - uint256 utilizeAmount, - uint256 incentiveAmount, - uint256 duration - ) public { + function testWithdrawMultiples(uint256 utilizeAmount, uint256 incentiveAmount, uint256 duration) public { vm.assume(utilizeAmount > 1e20 && utilizeAmount < 1e25); address user1 = address(1); @@ -293,8 +290,8 @@ contract SDIncentiveControllerTest is Test { sdUtilityPool.claim(2); vm.stopPrank(); - assertTrue(earn1 > 0, 'User1 did not earn any rewards'); - assertTrue(earn2 > 0, 'User2 did not earn any rewards'); + assertTrue(earn1 > 0, "User1 did not earn any rewards"); + assertTrue(earn2 > 0, "User2 did not earn any rewards"); uint256 user1FinalGain = staderToken.balanceOf(user1) - user1PrevBalance; uint256 user2FinalGain = staderToken.balanceOf(user2) - user2PrevBalance; @@ -350,7 +347,7 @@ contract SDIncentiveControllerTest is Test { // No approval vm.startPrank(staderManager); - vm.expectRevert('ERC20: insufficient allowance'); + vm.expectRevert("ERC20: insufficient allowance"); sdIncentiveController.start(1e22, 10); vm.stopPrank(); @@ -376,8 +373,8 @@ contract SDIncentiveControllerTest is Test { incentiveAmount = (incentiveAmount / duration) * duration; staderToken.transfer(staderManager, incentiveAmount); - console.log('Incentive amount: ', incentiveAmount); - console.log('Duration: ', duration); + console.log("Incentive amount: ", incentiveAmount); + console.log("Duration: ", duration); vm.startPrank(staderManager); staderToken.approve(address(sdIncentiveController), incentiveAmount); diff --git a/test/foundry_tests/SDUtilityPool.t.sol b/test/foundry_tests/SDUtilityPool.t.sol index a6e02f4c..7882be99 100644 --- a/test/foundry_tests/SDUtilityPool.t.sol +++ b/test/foundry_tests/SDUtilityPool.t.sol @@ -1,22 +1,22 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/SDUtilityPool.sol'; -import '../../contracts/interfaces/ISDUtilityPool.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/SDUtilityPool.sol"; +import "../../contracts/interfaces/ISDUtilityPool.sol"; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/SDIncentiveControllerMock.sol'; -import '../mocks/OperatorRewardsCollectorMock.sol'; -import '../mocks/PoolUtilsMock.sol'; +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/SDIncentiveControllerMock.sol"; +import "../mocks/OperatorRewardsCollectorMock.sol"; +import "../mocks/PoolUtilsMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract SDUtilityPoolTest is Test { address staderAdmin; @@ -31,10 +31,12 @@ contract SDUtilityPoolTest is Test { PoolUtilsMock poolUtils; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); address ethDepositAddr = vm.addr(102); staderTreasury = vm.addr(105); + address operator = address(500); staderToken = new StaderTokenMock(); ProxyAdmin admin = new ProxyAdmin(); @@ -43,7 +45,7 @@ contract SDUtilityPoolTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -51,7 +53,8 @@ contract SDUtilityPoolTest is Test { sdCollateral = new SDCollateralMock(); SDIncentiveControllerMock sdIncentiveController = new SDIncentiveControllerMock(); operatorRewardsCollector = new OperatorRewardsCollectorMock(); - poolUtils = new PoolUtilsMock(address(staderConfig)); + + poolUtils = new PoolUtilsMock(address(staderConfig), operator); vm.startPrank(staderAdmin); staderConfig.updateStaderToken(address(staderToken)); @@ -69,7 +72,7 @@ contract SDUtilityPoolTest is Test { TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( address(sdUtilityPoolImpl), address(admin), - '' + "" ); sdUtilityPool = SDUtilityPool(address(proxy)); staderToken.approve(address(sdUtilityPool), 1 ether); @@ -82,7 +85,7 @@ contract SDUtilityPoolTest is Test { TransparentUpgradeableProxy utilityPoolProxy = new TransparentUpgradeableProxy( address(utilityPoolImpl), address(admin), - '' + "" ); SDUtilityPool sdUtilityPool2 = SDUtilityPool(address(utilityPoolProxy)); staderToken.approve(address(sdUtilityPool2), 1 ether); @@ -119,12 +122,7 @@ contract SDUtilityPoolTest is Test { assertEq(ltv, 50); } - function test_Delegate( - uint128 sdAmount, - uint128 approveAmount, - uint16 randomSeed, - uint16 randomSeed2 - ) public { + function test_Delegate(uint128 sdAmount, uint128 approveAmount, uint16 randomSeed, uint16 randomSeed2) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(sdAmount <= deployerSDBalance / 4); vm.assume(sdAmount > 1e15); @@ -140,7 +138,7 @@ contract SDUtilityPoolTest is Test { vm.prank(staderManager); sdUtilityPool.pause(); vm.startPrank(user2); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.delegate(sdAmount); vm.stopPrank(); vm.prank(staderAdmin); @@ -199,18 +197,11 @@ contract SDUtilityPoolTest is Test { assertEq(sdUtilityPool.getDelegatorLatestSDBalance(user), 0); } - function test_RequestWithdraw( - uint128 sdDelegateAmount, - uint128 cTokenWithdrawAmount, - uint128 cTokenWithdrawAmount2, - uint16 randomSeed - ) public { - uint256 deployerSDBalance = staderToken.balanceOf(address(this)); - vm.assume(sdDelegateAmount <= deployerSDBalance / 2 && sdDelegateAmount > 1e15); - // vm.assume(cTokenWithdrawAmount <= sdDelegateAmount); - - vm.assume(randomSeed > 0); - address user = vm.addr(randomSeed); + function test_RequestWithdraw(uint128 cTokenWithdrawAmount, uint128 cTokenWithdrawAmount2) public { + uint deployerSDBalance = staderToken.balanceOf(address(this)); + address user = vm.addr(1000); + uint sdDelegateAmount = deployerSDBalance / 4; + vm.assume(sdDelegateAmount > 1e15); staderToken.transfer(user, sdDelegateAmount); staderToken.transfer(address(sdUtilityPool), sdDelegateAmount); @@ -229,7 +220,7 @@ contract SDUtilityPoolTest is Test { vm.prank(staderManager); sdUtilityPool.pause(); vm.startPrank(user); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.requestWithdraw(cTokenWithdrawAmount); vm.stopPrank(); vm.prank(staderAdmin); @@ -271,19 +262,16 @@ contract SDUtilityPoolTest is Test { vm.stopPrank(); } - function test_RequestWithdrawWithSDAndFullAmount( - uint128 sdDelegateAmount, - uint128 rewards, - uint16 randomSeed - ) public { + function test_RequestWithdrawWithSDAndFullAmount(uint128 sdDelegateAmount, uint128 rewards) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); - vm.assume(sdDelegateAmount <= deployerSDBalance / 2 && sdDelegateAmount > 1e15); - vm.assume(rewards <= deployerSDBalance / 2 && rewards > 1e18); - - vm.assume(randomSeed > 0); - address user = vm.addr(randomSeed); - vm.assume(user != address(this)); - + address user = vm.addr(1000); + vm.assume( + sdDelegateAmount <= deployerSDBalance / 2 && + sdDelegateAmount > 1e15 && + rewards <= deployerSDBalance / 2 && + rewards > 1e18 && + user != address(this) + ); staderToken.transfer(user, sdDelegateAmount); staderToken.transfer(address(sdUtilityPool), rewards); vm.startPrank(user); @@ -339,7 +327,7 @@ contract SDUtilityPoolTest is Test { vm.prank(staderManager); sdUtilityPool.pause(); vm.startPrank(user); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.requestWithdrawWithSDAmount(sdWithdrawAmount / 2); vm.stopPrank(); vm.prank(staderAdmin); @@ -412,7 +400,7 @@ contract SDUtilityPoolTest is Test { assertEq(sdUtilityPool.delegatorWithdrawRequestedCTokenCount(user2), user2CToken / 2 + user2CToken / 2); vm.prank(staderManager); sdUtilityPool.pause(); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.finalizeDelegatorWithdrawalRequest(); vm.startPrank(staderAdmin); sdUtilityPool.unpause(); @@ -479,7 +467,7 @@ contract SDUtilityPoolTest is Test { sdUtilityPool.updateProtocolFee(1e17); sdUtilityPool.pause(); vm.stopPrank(); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.utilize(utilizeAmount); vm.prank(staderAdmin); sdUtilityPool.unpause(); @@ -551,15 +539,11 @@ contract SDUtilityPoolTest is Test { sdUtilityPool.withdrawProtocolFee(sdUtilityPool.accumulatedProtocolFee()); sdUtilityPool.pause(); uint256 latestAccumulatedProtocolFee = sdUtilityPool.accumulatedProtocolFee(); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.withdrawProtocolFee(latestAccumulatedProtocolFee); } - function test_UtilizeWhileAddingKeys( - uint16 randomSeed, - uint128 utilizeAmount, - uint128 nonTerminalKeyCount - ) public { + function test_UtilizeWhileAddingKeys(uint16 randomSeed, uint128 utilizeAmount, uint128 nonTerminalKeyCount) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(randomSeed > 0); vm.assume(utilizeAmount < deployerSDBalance / 10); @@ -587,7 +571,7 @@ contract SDUtilityPoolTest is Test { vm.prank(staderManager); sdUtilityPool.pause(); vm.startPrank(permissionlessNodeRegistry); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.utilizeWhileAddingKeys(user, maxUtilize, nonTerminalKeyCount); vm.stopPrank(); vm.prank(staderAdmin); @@ -628,11 +612,7 @@ contract SDUtilityPoolTest is Test { vm.stopPrank(); } - function test_Repay( - uint8 randomSeed, - uint128 utilizeAmount, - uint128 repayAmount - ) public { + function test_Repay(uint8 randomSeed, uint128 utilizeAmount, uint128 repayAmount) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(randomSeed > 0); vm.assume(utilizeAmount < deployerSDBalance / 4); @@ -663,7 +643,7 @@ contract SDUtilityPoolTest is Test { sdUtilityPool.pause(); vm.stopPrank(); vm.prank(user); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.repay(repayAmount); vm.prank(staderAdmin); sdUtilityPool.unpause(); @@ -677,11 +657,7 @@ contract SDUtilityPoolTest is Test { assertEq(principal2, (principal1 * utilizeIndex2) / utilizeIndex1 - actualRepayAmount); } - function test_RepayOnBehalf( - uint8 randomSeed, - uint128 utilizeAmount, - uint128 repayAmount - ) public { + function test_RepayOnBehalf(uint8 randomSeed, uint128 utilizeAmount, uint128 repayAmount) public { uint256 deployerSDBalance = staderToken.balanceOf(address(this)); vm.assume(randomSeed > 0); vm.assume(utilizeAmount < deployerSDBalance / 4); @@ -710,7 +686,7 @@ contract SDUtilityPoolTest is Test { ); vm.prank(staderManager); sdUtilityPool.pause(); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.repayOnBehalf(user, repayAmount); vm.prank(staderAdmin); sdUtilityPool.unpause(); @@ -851,7 +827,7 @@ contract SDUtilityPoolTest is Test { sdUtilityPool.pause(); vm.stopPrank(); vm.startPrank(liquidator); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); sdUtilityPool.liquidationCall(operator); vm.stopPrank(); diff --git a/test/foundry_tests/StaderConfig.t.sol b/test/foundry_tests/StaderConfig.t.sol index 0f152126..60c0f9c8 100644 --- a/test/foundry_tests/StaderConfig.t.sol +++ b/test/foundry_tests/StaderConfig.t.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/StaderConfig.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract StaderConfigTest is Test { address staderAdmin; @@ -28,7 +28,7 @@ contract StaderConfigTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -64,7 +64,7 @@ contract StaderConfigTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); StaderConfig staderConfig2 = StaderConfig(address(configProxy)); staderConfig2.initialize(staderAdmin, vm.addr(102)); diff --git a/test/foundry_tests/StaderInsuranceFund.t.sol b/test/foundry_tests/StaderInsuranceFund.t.sol index 7f6a700f..f8e575e1 100644 --- a/test/foundry_tests/StaderInsuranceFund.t.sol +++ b/test/foundry_tests/StaderInsuranceFund.t.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderInsuranceFund.sol'; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/StaderInsuranceFund.sol"; +import "../../contracts/StaderConfig.sol"; -import '../mocks/PermissionedPoolMock.sol'; +import "../mocks/PermissionedPoolMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract StaderInsuranceFundTest is Test { address staderAdmin; @@ -31,7 +31,7 @@ contract StaderInsuranceFundTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -40,7 +40,7 @@ contract StaderInsuranceFundTest is Test { TransparentUpgradeableProxy iFundProxy = new TransparentUpgradeableProxy( address(iFundImpl), address(proxyAdmin), - '' + "" ); iFund = StaderInsuranceFund(address(iFundProxy)); iFund.initialize(staderAdmin, address(staderConfig)); @@ -56,7 +56,7 @@ contract StaderInsuranceFundTest is Test { TransparentUpgradeableProxy iFundProxy = new TransparentUpgradeableProxy( address(iFundImpl), address(proxyAdmin), - '' + "" ); StaderInsuranceFund iFund2 = StaderInsuranceFund(address(iFundProxy)); iFund2.initialize(staderAdmin, address(staderConfig)); @@ -68,12 +68,11 @@ contract StaderInsuranceFundTest is Test { UtilLib.onlyManagerRole(staderManager, staderConfig); } - function test_depositFund(uint256 _ethAmount, address anyone) public { - vm.assume(anyone != address(0) && anyone != address(proxyAdmin)); - + function test_depositFund(uint256 _ethAmount) public { + address anyone = vm.addr(1000); hoax(address(anyone), _ethAmount); // provides anyone _ethAmount and makes it the caller for next call assertEq(address(iFund).balance, 0); - iFund.depositFund{value: _ethAmount}(); + iFund.depositFund{ value: _ethAmount }(); assertEq(address(iFund).balance, _ethAmount); } @@ -83,7 +82,7 @@ contract StaderInsuranceFundTest is Test { uint256 depositAmount = 5 ether; startHoax(anyone, depositAmount); - iFund.depositFund{value: depositAmount}(); + iFund.depositFund{ value: depositAmount }(); assertEq(address(iFund).balance, depositAmount); vm.expectRevert(UtilLib.CallerNotManager.selector); @@ -113,7 +112,7 @@ contract StaderInsuranceFundTest is Test { uint256 depositAmount = 5 ether; startHoax(anyone, depositAmount); - iFund.depositFund{value: depositAmount}(); + iFund.depositFund{ value: depositAmount }(); assertEq(address(iFund).balance, depositAmount); vm.expectRevert(UtilLib.CallerNotStaderContract.selector); diff --git a/test/foundry_tests/StaderOracle.t.sol b/test/foundry_tests/StaderOracle.t.sol index 5694ee6e..b818690d 100644 --- a/test/foundry_tests/StaderOracle.t.sol +++ b/test/foundry_tests/StaderOracle.t.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderOracle.sol'; -import '../../contracts/SocializingPool.sol'; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/StaderOracle.sol"; +import "../../contracts/SocializingPool.sol"; +import "../../contracts/StaderConfig.sol"; -import '../mocks/StaderTokenMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/PoolUtilsMock.sol'; +import "../mocks/StaderTokenMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; +import "../mocks/PoolUtilsMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract StaderOracleTest is Test { address staderAdmin; @@ -27,9 +27,11 @@ contract StaderOracleTest is Test { StaderTokenMock staderToken; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); address ethDepositAddr = vm.addr(102); + address operator = address(500); staderToken = new StaderTokenMock(); ProxyAdmin admin = new ProxyAdmin(); @@ -38,7 +40,7 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -47,7 +49,7 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy oracleProxy = new TransparentUpgradeableProxy( address(oracleImpl), address(admin), - '' + "" ); staderOracle = StaderOracle(address(oracleProxy)); staderOracle.initialize(staderAdmin, address(staderConfig)); @@ -56,7 +58,7 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy permissionedSPProxy = new TransparentUpgradeableProxy( address(spImpl), address(admin), - '' + "" ); permissionedSP = SocializingPool(payable(permissionedSPProxy)); permissionedSP.initialize(staderAdmin, address(staderConfig)); @@ -64,12 +66,12 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy permissionlessSPProxy = new TransparentUpgradeableProxy( address(spImpl), address(admin), - '' + "" ); permissionlessSP = SocializingPool(payable(permissionlessSPProxy)); permissionlessSP.initialize(staderAdmin, address(staderConfig)); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); vm.startPrank(staderAdmin); staderConfig.updateStaderOracle(address(staderOracle)); @@ -87,7 +89,7 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy oracleProxy = new TransparentUpgradeableProxy( address(oracleImpl), address(admin), - '' + "" ); StaderOracle staderOracle2 = StaderOracle(address(oracleProxy)); staderOracle2.initialize(staderAdmin, address(staderConfig)); @@ -96,7 +98,7 @@ contract StaderOracleTest is Test { TransparentUpgradeableProxy permissionedSPProxy = new TransparentUpgradeableProxy( address(spImpl), address(admin), - '' + "" ); SocializingPool permissionedSP2 = SocializingPool(payable(permissionedSPProxy)); permissionedSP2.initialize(staderAdmin, address(staderConfig)); @@ -175,7 +177,7 @@ contract StaderOracleTest is Test { } function test_submitSDPrice() public { - SDPriceData memory sdPriceData = SDPriceData({reportingBlockNumber: 1212, sdPriceInETH: 1}); + SDPriceData memory sdPriceData = SDPriceData({ reportingBlockNumber: 1212, sdPriceInETH: 1 }); vm.expectRevert(IStaderOracle.NotATrustedNode.selector); staderOracle.submitSDPrice(sdPriceData); @@ -326,7 +328,7 @@ contract StaderOracleTest is Test { } function test_submitSDPrice_manipulation_not_possible_by_minority_malicious_oracles() public { - SDPriceData memory sdPriceData = SDPriceData({reportingBlockNumber: 1212, sdPriceInETH: 1}); + SDPriceData memory sdPriceData = SDPriceData({ reportingBlockNumber: 1212, sdPriceInETH: 1 }); assertEq(staderOracle.MIN_TRUSTED_NODES(), 5); address trustedNode1 = vm.addr(701); @@ -484,7 +486,7 @@ contract StaderOracleTest is Test { staderOracle.pause(); vm.prank(trustedNode1); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); staderOracle.submitSocializingRewardsMerkleRoot(rewardsData); // now lets unpause and then try @@ -728,7 +730,7 @@ contract StaderOracleTest is Test { permissionlessSP.pause(); vm.prank(operator2); - vm.expectRevert('Pausable: paused'); + vm.expectRevert("Pausable: paused"); permissionlessSP.claim(indexArray, sdAmountArray, ethAmountArray, proofArray); // now lets unpause and then try @@ -786,7 +788,7 @@ contract StaderOracleTest is Test { assertEq(address(permissionlessSP).balance, 0); hoax(randomEOA, amount); // provides amount eth to user and makes it the caller for next call - (bool success, ) = payable(permissionlessSP).call{value: amount}(''); + (bool success, ) = payable(permissionlessSP).call{ value: amount }(""); assertTrue(success); assertEq(address(permissionlessSP).balance, amount); } @@ -991,11 +993,11 @@ contract StaderOracleTest is Test { function test_submitValidatorVerificationDetail() public { bytes[] memory readyToDepositPubkeys = new bytes[](1); - readyToDepositPubkeys[0] = 'readyToDepositPubkey1'; + readyToDepositPubkeys[0] = "readyToDepositPubkey1"; bytes[] memory frontRunPubkeys = new bytes[](1); - frontRunPubkeys[0] = 'frontRunPubkey1'; + frontRunPubkeys[0] = "frontRunPubkey1"; bytes[] memory invalidSignaturePubkeys = new bytes[](1); - invalidSignaturePubkeys[0] = 'invalidSignaturePubkey1'; + invalidSignaturePubkeys[0] = "invalidSignaturePubkey1"; ValidatorVerificationDetail memory vvData = ValidatorVerificationDetail({ poolId: 1, @@ -1072,7 +1074,7 @@ contract StaderOracleTest is Test { function test_submitMissedAttestationPenalties() public { bytes[] memory sortedPubkeys = new bytes[](1); - sortedPubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + sortedPubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; MissedAttestationPenaltyData memory mapData = MissedAttestationPenaltyData({ reportingBlockNumber: 1, @@ -1152,7 +1154,7 @@ contract StaderOracleTest is Test { function test_submitWithdrawnValidators() public { bytes[] memory sortedPubkeys = new bytes[](1); - sortedPubkeys[0] = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + sortedPubkeys[0] = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; WithdrawnValidators memory wvData = WithdrawnValidators({ reportingBlockNumber: 1, diff --git a/test/foundry_tests/StaderStakePoolManager.t.sol b/test/foundry_tests/StaderStakePoolManager.t.sol index ae429035..2d21905d 100644 --- a/test/foundry_tests/StaderStakePoolManager.t.sol +++ b/test/foundry_tests/StaderStakePoolManager.t.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/ETHx.sol'; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/StaderStakePoolsManager.sol'; +import "../../contracts/ETHx.sol"; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/StaderStakePoolsManager.sol"; -import '../mocks/PoolMock.sol'; -import '../mocks/PoolUtilsMock.sol'; -import '../mocks/StaderOracleMock.sol'; +import "../mocks/PoolMock.sol"; +import "../mocks/PoolUtilsMock.sol"; +import "../mocks/StaderOracleMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/utils/math/Math.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/utils/math/Math.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract StaderStakePoolManagerTest is Test { using Math for uint256; @@ -46,13 +46,13 @@ contract StaderStakePoolManagerTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); ETHx ethXImpl = new ETHx(); - TransparentUpgradeableProxy ethXProxy = new TransparentUpgradeableProxy(address(ethXImpl), address(admin), ''); + TransparentUpgradeableProxy ethXProxy = new TransparentUpgradeableProxy(address(ethXImpl), address(admin), ""); ethX = ETHx(address(ethXProxy)); ethX.initialize(staderAdmin, address(staderConfig)); @@ -60,7 +60,7 @@ contract StaderStakePoolManagerTest is Test { TransparentUpgradeableProxy staderStakePoolManagerProxy = new TransparentUpgradeableProxy( address(staderStakePoolManagerImpl), address(admin), - '' + "" ); stakePoolManager = StaderStakePoolsManager(payable(staderStakePoolManagerProxy)); @@ -69,7 +69,7 @@ contract StaderStakePoolManagerTest is Test { permissionlessPoolAddress = new PoolMock(vm.addr(120)); permissionedPoolAddress = new PoolMock(vm.addr(130)); staderOracle = new StaderOracleMock(); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); vm.startPrank(staderAdmin); staderConfig.updateETHxToken(address(ethX)); @@ -91,7 +91,7 @@ contract StaderStakePoolManagerTest is Test { TransparentUpgradeableProxy staderStakePoolManagerProxy = new TransparentUpgradeableProxy( address(staderStakePoolManagerImpl), address(admin), - '' + "" ); stakePoolManager = StaderStakePoolsManager(payable(staderStakePoolManagerProxy)); @@ -109,7 +109,7 @@ contract StaderStakePoolManagerTest is Test { address externalEOA = vm.addr(1000); startHoax(externalEOA); vm.expectRevert(IStaderStakePoolManager.UnsupportedOperation.selector); - payable(stakePoolManager).call{value: 1 ether}(''); + payable(stakePoolManager).call{ value: 1 ether }(""); vm.stopPrank(); } @@ -117,7 +117,7 @@ contract StaderStakePoolManagerTest is Test { address externalEOA = vm.addr(1000); startHoax(externalEOA); vm.expectRevert(IStaderStakePoolManager.UnsupportedOperation.selector); - payable(stakePoolManager).call{value: 1 ether}('abi.encodeWithSignature("nonExistentFunction()")'); + payable(stakePoolManager).call{ value: 1 ether }('abi.encodeWithSignature("nonExistentFunction()")'); vm.stopPrank(); } @@ -126,7 +126,7 @@ contract StaderStakePoolManagerTest is Test { address randomAddr = vm.addr(privateKey); startHoax(randomAddr, amount); assertEq(address(stakePoolManager).balance, 0); - stakePoolManager.receiveExecutionLayerRewards{value: amount}(); + stakePoolManager.receiveExecutionLayerRewards{ value: amount }(); assertEq(address(stakePoolManager).balance, amount); } @@ -135,7 +135,7 @@ contract StaderStakePoolManagerTest is Test { address randomAddr = vm.addr(privateKey); startHoax(randomAddr, amount); assertEq(address(stakePoolManager).balance, 0); - stakePoolManager.receiveWithdrawVaultUserShare{value: amount}(); + stakePoolManager.receiveWithdrawVaultUserShare{ value: amount }(); assertEq(address(stakePoolManager).balance, amount); } @@ -144,7 +144,7 @@ contract StaderStakePoolManagerTest is Test { address randomAddr = vm.addr(privateKey); startHoax(randomAddr, amount); assertEq(address(stakePoolManager).balance, 0); - stakePoolManager.receiveEthFromAuction{value: amount}(); + stakePoolManager.receiveEthFromAuction{ value: amount }(); assertEq(address(stakePoolManager).balance, amount); } @@ -153,7 +153,7 @@ contract StaderStakePoolManagerTest is Test { address randomAddr = vm.addr(privateKey); startHoax(randomAddr, amount); assertEq(address(stakePoolManager).balance, 0); - stakePoolManager.receiveExcessEthFromPool{value: amount}(1); + stakePoolManager.receiveExcessEthFromPool{ value: amount }(1); assertEq(address(stakePoolManager).balance, amount); } @@ -191,15 +191,15 @@ contract StaderStakePoolManagerTest is Test { } function test_getExchangeRate(uint256 _totalETHx, uint256 _totalETH) public { - vm.assume(_totalETHx > 0 && _totalETHx < 120 * 10**24); - vm.assume(_totalETH > 0 && _totalETH < 120 * 10**24); - assertEq(stakePoolManager.getExchangeRate(), 1 * 10**18); + vm.assume(_totalETHx > 0 && _totalETHx < 120 * 10 ** 24); + vm.assume(_totalETH > 0 && _totalETH < 120 * 10 ** 24); + assertEq(stakePoolManager.getExchangeRate(), 1 * 10 ** 18); vm.mockCall( address(staderOracle), abi.encodeWithSelector(IStaderOracle.getExchangeRate.selector), abi.encode(block.number, _totalETH, _totalETHx) ); - uint256 exchangeRate = (_totalETH * 10**18) / _totalETHx; + uint256 exchangeRate = (_totalETH * 10 ** 18) / _totalETHx; assertEq(stakePoolManager.getExchangeRate(), exchangeRate); } @@ -278,17 +278,17 @@ contract StaderStakePoolManagerTest is Test { vm.prank(staderManager); stakePoolManager.pause(); - vm.expectRevert('Pausable: paused'); - stakePoolManager.deposit{value: 1}(receiver); + vm.expectRevert("Pausable: paused"); + stakePoolManager.deposit{ value: 1 }(receiver); vm.prank(staderAdmin); stakePoolManager.unpause(); vm.expectRevert(IStaderStakePoolManager.InvalidDepositAmount.selector); - stakePoolManager.deposit{value: 1}(receiver); + stakePoolManager.deposit{ value: 1 }(receiver); vm.expectRevert(IStaderStakePoolManager.InvalidDepositAmount.selector); - stakePoolManager.deposit{value: 100000 ether}(receiver); - assertEq(stakePoolManager.deposit{value: 100 ether}(receiver), 100 ether); + stakePoolManager.deposit{ value: 100000 ether }(receiver); + assertEq(stakePoolManager.deposit{ value: 100 ether }(receiver), 100 ether); assertEq(ethX.balanceOf(receiver), 100 ether); assertEq(address(stakePoolManager).balance, 100 ether); } @@ -321,7 +321,7 @@ contract StaderStakePoolManagerTest is Test { ); vm.expectRevert(IStaderStakePoolManager.PoolIdDoesNotExit.selector); stakePoolManager.validatorBatchDeposit(1); - stakePoolManager.deposit{value: 100 ether}(address(this)); + stakePoolManager.deposit{ value: 100 ether }(address(this)); vm.mockCall(address(poolUtils), abi.encodeWithSelector(IPoolUtils.isExistingPoolId.selector), abi.encode(true)); vm.mockCall( address(userWithdrawManager), @@ -363,7 +363,7 @@ contract StaderStakePoolManagerTest is Test { } function test_depositETHOverTargetWeight() public { - stakePoolManager.deposit{value: 100 ether}(address(this)); + stakePoolManager.deposit{ value: 100 ether }(address(this)); vm.expectRevert(IStaderStakePoolManager.CooldownNotComplete.selector); stakePoolManager.depositETHOverTargetWeight(); diff --git a/test/foundry_tests/UserWithdrawalManager.t.sol b/test/foundry_tests/UserWithdrawalManager.t.sol index 26bca07e..9e0fecda 100644 --- a/test/foundry_tests/UserWithdrawalManager.t.sol +++ b/test/foundry_tests/UserWithdrawalManager.t.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/ETHx.sol'; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/UserWithdrawalManager.sol'; +import "../../contracts/ETHx.sol"; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/UserWithdrawalManager.sol"; -import '../mocks/StaderOracleMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; +import "../mocks/StaderOracleMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract UserWithdrawalManagerTest is Test { address staderAdmin; @@ -27,6 +27,7 @@ contract UserWithdrawalManagerTest is Test { StakePoolManagerMock staderStakePoolManager; function setUp() public { + vm.clearMockedCalls(); staderAdmin = vm.addr(100); staderManager = vm.addr(101); operator = vm.addr(102); @@ -38,20 +39,20 @@ contract UserWithdrawalManagerTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(admin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, address(ethDepositAddr)); ETHx ethXImpl = new ETHx(); - TransparentUpgradeableProxy ethXProxy = new TransparentUpgradeableProxy(address(ethXImpl), address(admin), ''); + TransparentUpgradeableProxy ethXProxy = new TransparentUpgradeableProxy(address(ethXImpl), address(admin), ""); ethX = ETHx(address(ethXProxy)); ethX.initialize(staderAdmin, address(staderConfig)); UserWithdrawalManager userWithdrawalManagerImp = new UserWithdrawalManager(); TransparentUpgradeableProxy userWithdrawalManagerProxy = new TransparentUpgradeableProxy( address(userWithdrawalManagerImp), address(admin), - '' + "" ); userWithdrawalManager = UserWithdrawalManager(payable(userWithdrawalManagerProxy)); @@ -78,7 +79,7 @@ contract UserWithdrawalManagerTest is Test { TransparentUpgradeableProxy userWithdrawalManagerProxy = new TransparentUpgradeableProxy( address(userWithdrawalManagerImp), address(admin), - '' + "" ); userWithdrawalManager = UserWithdrawalManager(payable(userWithdrawalManagerProxy)); @@ -97,7 +98,7 @@ contract UserWithdrawalManagerTest is Test { function test_ReceiveFunction() public { vm.deal(address(this), 2 ether); - payable(userWithdrawalManager).call{value: 1 ether}(''); + payable(userWithdrawalManager).call{ value: 1 ether }(""); assertEq(address(this).balance, 1 ether); assertEq(address(userWithdrawalManager).balance, 1 ether); } diff --git a/test/foundry_tests/ValidatorWithdrawalVault.t.sol b/test/foundry_tests/ValidatorWithdrawalVault.t.sol index 6d6381a5..52d39be0 100644 --- a/test/foundry_tests/ValidatorWithdrawalVault.t.sol +++ b/test/foundry_tests/ValidatorWithdrawalVault.t.sol @@ -1,25 +1,31 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import { Test } from "forge-std/Test.sol"; +import { console2 } from "forge-std/console2.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/VaultProxy.sol'; -import '../../contracts/ValidatorWithdrawalVault.sol'; -import '../../contracts/OperatorRewardsCollector.sol'; -import '../../contracts/factory/VaultFactory.sol'; +import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; -import '../mocks/PoolUtilsMock.sol'; -import '../mocks/PenaltyMockForVault.sol'; -import '../mocks/SDCollateralMock.sol'; -import '../mocks/StakePoolManagerMock.sol'; -import '../mocks/SDUtilityPoolMock.sol'; +import "../../contracts/library/UtilLib.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/VaultProxy.sol"; +import "../../contracts/ValidatorWithdrawalVault.sol"; +import "../../contracts/OperatorRewardsCollector.sol"; +import "../../contracts/factory/VaultFactory.sol"; + +import "../mocks/PoolUtilsMock.sol"; +import "../mocks/PenaltyMockForVault.sol"; +import "../mocks/SDCollateralMock.sol"; +import "../mocks/StakePoolManagerMock.sol"; + +import { SDUtilityPoolMock } from "../mocks/SDUtilityPoolMock.sol"; +import { StaderOracleMock } from "../mocks/StaderOracleMock.sol"; contract ValidatorWithdrawalVaultTest is Test { + address private constant OPERATOR_ADDRESS = address(500); + address staderAdmin; address staderManager; address staderTreasury; @@ -34,12 +40,19 @@ contract ValidatorWithdrawalVaultTest is Test { VaultFactory vaultFactory; function setUp() public { + vm.clearMockedCalls(); poolId = 1; validatorId = 1; staderAdmin = vm.addr(100); staderManager = vm.addr(101); address ethDepositAddr = vm.addr(102); + address staderOracleMock = vm.addr(103); + address sdUtilityPoolMock = vm.addr(104); + address operator = OPERATOR_ADDRESS; + + mockStaderOracle(staderOracleMock); + mockSDUtilityPool(sdUtilityPoolMock, operator); ProxyAdmin proxyAdmin = new ProxyAdmin(); @@ -47,7 +60,7 @@ contract ValidatorWithdrawalVaultTest is Test { TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); @@ -56,19 +69,18 @@ contract ValidatorWithdrawalVaultTest is Test { TransparentUpgradeableProxy operatorRCProxy = new TransparentUpgradeableProxy( address(operatorRCImpl), address(proxyAdmin), - '' + "" ); operatorRC = OperatorRewardsCollector(address(operatorRCProxy)); operatorRC.initialize(staderAdmin, address(staderConfig)); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); PenaltyMockForVault penaltyContract = new PenaltyMockForVault(); SDCollateralMock sdCollateral = new SDCollateralMock(); - SDUtilityPoolMock sdUtilityPool = new SDUtilityPoolMock(); ValidatorWithdrawalVault withdrawVaultImpl = new ValidatorWithdrawalVault(); VaultFactory vfImpl = new VaultFactory(); - TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ''); + TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ""); vaultFactory = VaultFactory(address(vfProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -78,9 +90,10 @@ contract ValidatorWithdrawalVaultTest is Test { staderConfig.updatePoolUtils(address(poolUtils)); staderConfig.updatePenaltyContract(address(penaltyContract)); staderConfig.updateSDCollateral(address(sdCollateral)); - staderConfig.updateSDUtilityPool(address(sdUtilityPool)); + staderConfig.updateSDUtilityPool(sdUtilityPoolMock); staderConfig.updateOperatorRewardsCollector(address(operatorRC)); staderConfig.updateValidatorWithdrawalVaultImplementation(address(withdrawVaultImpl)); + staderConfig.updateStaderOracle(staderOracleMock); staderConfig.grantRole(staderConfig.MANAGER(), staderManager); vaultFactory.grantRole(vaultFactory.NODE_REGISTRY_CONTRACT(), address(poolUtils.nodeRegistry())); vm.stopPrank(); @@ -95,7 +108,7 @@ contract ValidatorWithdrawalVaultTest is Test { TransparentUpgradeableProxy operatorRCProxy = new TransparentUpgradeableProxy( address(operatorRCImpl), address(proxyAdmin), - '' + "" ); OperatorRewardsCollector operatorRC2 = OperatorRewardsCollector(address(operatorRCProxy)); operatorRC2.initialize(staderAdmin, address(staderConfig)); @@ -122,7 +135,7 @@ contract ValidatorWithdrawalVaultTest is Test { assertEq(withdrawVaultClone.balance, 0); hoax(randomEOA, amount); // provides amount eth to user and makes it the caller for next call - (bool success, ) = withdrawVaultClone.call{value: amount}(''); + (bool success, ) = withdrawVaultClone.call{ value: amount }(""); assertTrue(success); assertEq(withdrawVaultClone.balance, amount); } @@ -141,8 +154,8 @@ contract ValidatorWithdrawalVaultTest is Test { StakePoolManagerMock sspm = new StakePoolManagerMock(); address treasury = vm.addr(3); - address operator = address(500); address opRewardAddr = vm.addr(4); + address operator = OPERATOR_ADDRESS; vm.prank(staderAdmin); staderConfig.updateStakePoolManager(address(sspm)); @@ -257,7 +270,7 @@ contract ValidatorWithdrawalVaultTest is Test { StakePoolManagerMock sspm = new StakePoolManagerMock(); address treasury = vm.addr(3); - address operator = address(500); + address operator = OPERATOR_ADDRESS; address opRewardAddr = vm.addr(4); vm.prank(staderAdmin); @@ -287,8 +300,8 @@ contract ValidatorWithdrawalVaultTest is Test { vm.deal(withdrawVaultClone, rewardEth); // send rewardEth to withdrawVault StakePoolManagerMock sspm = new StakePoolManagerMock(); + address operator = OPERATOR_ADDRESS; address treasury = vm.addr(3); - address operator = address(500); address opRewardAddr = vm.addr(4); vm.prank(staderAdmin); @@ -329,7 +342,11 @@ contract ValidatorWithdrawalVaultTest is Test { vm.prank(operator); operatorRC.claim(); - assertEq(address(opRewardAddr).balance, operatorShare - penaltyAmt); + assertEq( + address(opRewardAddr).balance, + operatorShare - penaltyAmt, + "expect reward balance to be operatorShare - penaltyAmt" + ); assertEq(operatorRC.balances(operator), 0); } @@ -349,4 +366,23 @@ contract ValidatorWithdrawalVaultTest is Test { VaultProxy(withdrawVaultClone).updateOwner(); assertEq(VaultProxy(withdrawVaultClone).owner(), vm.addr(203)); } + + function mockStaderOracle(address staderOracleMock) private { + emit log_named_address("staderOracleMock", staderOracleMock); + StaderOracleMock implementation = new StaderOracleMock(); + bytes memory mockCode = address(implementation).code; + vm.etch(staderOracleMock, mockCode); + } + + function mockSDUtilityPool(address sdUtilityPoolMock, address _operator) private { + emit log_named_address("sdUtilityPool", sdUtilityPoolMock); + SDUtilityPoolMock implementation = new SDUtilityPoolMock(); + bytes memory mockCode = address(implementation).code; + vm.etch(sdUtilityPoolMock, mockCode); + vm.mockCall( + sdUtilityPoolMock, + abi.encodeWithSelector(ISDUtilityPool.getUserData.selector, _operator), + abi.encode(UserData(0 ether, 4 ether, 1, 0)) + ); + } } diff --git a/test/foundry_tests/VaultFactory.t.sol b/test/foundry_tests/VaultFactory.t.sol index 97a7a1ba..8434fccc 100644 --- a/test/foundry_tests/VaultFactory.t.sol +++ b/test/foundry_tests/VaultFactory.t.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/library/UtilLib.sol'; +import "../../contracts/library/UtilLib.sol"; -import '../../contracts/StaderConfig.sol'; -import '../../contracts/factory/VaultFactory.sol'; -import '../../contracts/NodeELRewardVault.sol'; -import '../../contracts/ValidatorWithdrawalVault.sol'; +import "../../contracts/StaderConfig.sol"; +import "../../contracts/factory/VaultFactory.sol"; +import "../../contracts/NodeELRewardVault.sol"; +import "../../contracts/ValidatorWithdrawalVault.sol"; -import '../mocks/PoolUtilsMock.sol'; +import "../mocks/PoolUtilsMock.sol"; -import 'forge-std/Test.sol'; -import '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; -import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; +import "forge-std/Test.sol"; +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; contract VaultFactoryTest is Test { address staderAdmin; @@ -25,22 +25,23 @@ contract VaultFactoryTest is Test { function setUp() public { staderAdmin = vm.addr(100); address ethDepositAddr = vm.addr(102); - + address operator = address(500); + ProxyAdmin proxyAdmin = new ProxyAdmin(); StaderConfig configImpl = new StaderConfig(); TransparentUpgradeableProxy configProxy = new TransparentUpgradeableProxy( address(configImpl), address(proxyAdmin), - '' + "" ); staderConfig = StaderConfig(address(configProxy)); staderConfig.initialize(staderAdmin, ethDepositAddr); - poolUtils = new PoolUtilsMock(address(staderConfig)); + poolUtils = new PoolUtilsMock(address(staderConfig), operator); VaultFactory vfImpl = new VaultFactory(); - TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ''); + TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ""); vaultFactory = VaultFactory(address(vfProxy)); vaultFactory.initialize(staderAdmin, address(staderConfig)); @@ -61,7 +62,7 @@ contract VaultFactoryTest is Test { function test_JustToIncreaseCoverage() public { ProxyAdmin proxyAdmin = new ProxyAdmin(); VaultFactory vfImpl = new VaultFactory(); - TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ''); + TransparentUpgradeableProxy vfProxy = new TransparentUpgradeableProxy(address(vfImpl), address(proxyAdmin), ""); VaultFactory vaultFactory2 = VaultFactory(address(vfProxy)); vaultFactory2.initialize(staderAdmin, address(staderConfig)); } diff --git a/test/mocks/NodeRegistryMock.sol b/test/mocks/NodeRegistryMock.sol index e1002de0..e8f8a933 100644 --- a/test/mocks/NodeRegistryMock.sol +++ b/test/mocks/NodeRegistryMock.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/interfaces/INodeRegistry.sol'; +import "../../contracts/interfaces/INodeRegistry.sol"; contract NodeRegistryMock { mapping(uint256 => Validator) public validatorRegistry; mapping(uint256 => Operator) public operatorStructById; - constructor() { + constructor(address _operatorAddress) { validatorRegistry[1].withdrawVaultAddress = address(1); validatorRegistry[1].operatorId = 1; - validatorRegistry[1].pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + validatorRegistry[1].pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; - operatorStructById[1].operatorAddress = address(500); + operatorStructById[1].operatorAddress = _operatorAddress; } function operatorIDByAddress(address) external pure returns (uint256) { @@ -43,11 +43,7 @@ contract NodeRegistryMock { return 4 ether; } - function markValidatorReadyToDeposit( - bytes[] calldata, - bytes[] calldata, - bytes[] calldata - ) external {} + function markValidatorReadyToDeposit(bytes[] calldata, bytes[] calldata, bytes[] calldata) external {} function withdrawnValidators(bytes[] calldata) external {} } diff --git a/test/mocks/PermissionedNodeRegistryMock.sol b/test/mocks/PermissionedNodeRegistryMock.sol index 2f10293b..7ead5666 100644 --- a/test/mocks/PermissionedNodeRegistryMock.sol +++ b/test/mocks/PermissionedNodeRegistryMock.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import 'forge-std/Test.sol'; -import '../../contracts/interfaces/INodeRegistry.sol'; +import "forge-std/Test.sol"; +import "../../contracts/interfaces/INodeRegistry.sol"; contract PermissionedNodeRegistryMock { mapping(uint256 => Validator) public validatorRegistry; @@ -10,16 +10,14 @@ contract PermissionedNodeRegistryMock { constructor() { validatorRegistry[1].withdrawVaultAddress = address(1); validatorRegistry[1].operatorId = 1; - validatorRegistry[1].pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + validatorRegistry[1].pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; validatorRegistry[1] - .preDepositSignature = '8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + .preDepositSignature = "8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; } - function allocateValidatorsAndUpdateOperatorId(uint256) - external - pure - returns (uint256[] memory selectedOperatorCapacity) - { + function allocateValidatorsAndUpdateOperatorId( + uint256 + ) external pure returns (uint256[] memory selectedOperatorCapacity) { selectedOperatorCapacity = new uint256[](3); selectedOperatorCapacity[0] = 0; selectedOperatorCapacity[1] = 0; @@ -38,11 +36,7 @@ contract PermissionedNodeRegistryMock { return 5; } - function getOperatorTotalNonTerminalKeys( - address, - uint256, - uint256 - ) public pure returns (uint64) { + function getOperatorTotalNonTerminalKeys(address, uint256, uint256) public pure returns (uint64) { return 5; } diff --git a/test/mocks/PermissionedPoolMock.sol b/test/mocks/PermissionedPoolMock.sol index 1e97fd1f..5da9b7ad 100644 --- a/test/mocks/PermissionedPoolMock.sol +++ b/test/mocks/PermissionedPoolMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/StaderConfig.sol"; contract PermissionedPoolMock { StaderConfig staderConfig; diff --git a/test/mocks/PermissionlessNodeRegistryMock.sol b/test/mocks/PermissionlessNodeRegistryMock.sol index 537adda1..ea80d374 100644 --- a/test/mocks/PermissionlessNodeRegistryMock.sol +++ b/test/mocks/PermissionlessNodeRegistryMock.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import 'forge-std/Test.sol'; -import '../../contracts/interfaces/INodeRegistry.sol'; -import '../../contracts/interfaces/IPermissionlessPool.sol'; +import "forge-std/Test.sol"; +import "../../contracts/interfaces/INodeRegistry.sol"; +import "../../contracts/interfaces/IPermissionlessPool.sol"; contract PermissionlessNodeRegistryMock { mapping(uint256 => Validator) public validatorRegistry; @@ -11,15 +11,15 @@ contract PermissionlessNodeRegistryMock { constructor() { validatorRegistry[1].withdrawVaultAddress = address(1); validatorRegistry[1].operatorId = 1; - validatorRegistry[1].pubkey = '0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750'; + validatorRegistry[1].pubkey = "0x8faa339ba46c649885ea0fc9c34d32f9d99c5bde336750"; validatorRegistry[1] - .preDepositSignature = '8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + .preDepositSignature = "8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; validatorRegistry[1] - .depositSignature = '8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6'; + .depositSignature = "8faa339ba46c649885ea0fc9c34d32f9d99c5bde3367500ee111075fc390fa48d8dbe155633ad489ee5866e152a5f6"; } function transferCollateralToPool(uint256 _amount) external { - IPermissionlessPool(msg.sender).receiveRemainingCollateralETH{value: _amount}(); + IPermissionlessPool(msg.sender).receiveRemainingCollateralETH{ value: _amount }(); } function nextQueuedValidatorIndex() external pure returns (uint256) { @@ -40,11 +40,7 @@ contract PermissionlessNodeRegistryMock { return 5; } - function getOperatorTotalNonTerminalKeys( - address, - uint256, - uint256 - ) public pure returns (uint64) { + function getOperatorTotalNonTerminalKeys(address, uint256, uint256) public pure returns (uint64) { return 5; } @@ -64,6 +60,10 @@ contract PermissionlessNodeRegistryMock { function updateDepositStatusAndBlock(uint256 _validatorId) external {} + function nodeELRewardVaultByOperatorId(uint256) external pure returns (address) { + return address(0x0); + } + function POOL_ID() external pure returns (uint8) { return 1; } diff --git a/test/mocks/PoolUtilsMock.sol b/test/mocks/PoolUtilsMock.sol index da958e39..8cc912b4 100644 --- a/test/mocks/PoolUtilsMock.sol +++ b/test/mocks/PoolUtilsMock.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import './NodeRegistryMock.sol'; -import '../../contracts/StaderConfig.sol'; +import "./NodeRegistryMock.sol"; +import "../../contracts/StaderConfig.sol"; contract PoolUtilsMock { NodeRegistryMock public nodeRegistry; uint256 operatorTotalNonTerminalKeys; StaderConfig staderConfig; - constructor(address _staderConfigAddr) { - nodeRegistry = new NodeRegistryMock(); + constructor(address _staderConfigAddr, address _operator) { + nodeRegistry = new NodeRegistryMock(_operator); operatorTotalNonTerminalKeys = 5; staderConfig = StaderConfig(_staderConfigAddr); } @@ -23,12 +23,7 @@ contract PoolUtilsMock { return address(nodeRegistry); } - function getOperatorTotalNonTerminalKeys( - uint8, - address, - uint256, - uint256 - ) public view returns (uint256) { + function getOperatorTotalNonTerminalKeys(uint8, address, uint256, uint256) public view returns (uint256) { return operatorTotalNonTerminalKeys; } @@ -40,15 +35,10 @@ contract PoolUtilsMock { } } - function calculateRewardShare(uint8 _poolId, uint256 _totalRewards) - external - view - returns ( - uint256 userShare, - uint256 operatorShare, - uint256 protocolShare - ) - { + function calculateRewardShare( + uint8 _poolId, + uint256 _totalRewards + ) external view returns (uint256 userShare, uint256 operatorShare, uint256 protocolShare) { uint256 TOTAL_STAKED_ETH = staderConfig.getStakedEthPerNode(); uint256 collateralETH = getCollateralETH(_poolId); uint256 usersETH = TOTAL_STAKED_ETH - collateralETH; diff --git a/test/mocks/PoolUtilsMockForDepositFlow.sol b/test/mocks/PoolUtilsMockForDepositFlow.sol index 3f56fff0..8c189196 100644 --- a/test/mocks/PoolUtilsMockForDepositFlow.sol +++ b/test/mocks/PoolUtilsMockForDepositFlow.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/StaderConfig.sol'; +import "../../contracts/StaderConfig.sol"; contract PoolUtilsMockForDepositFlow { address nodeRegistry; @@ -98,15 +98,7 @@ contract PoolUtilsMockForDepositFlow { } } - function calculateRewardShare(uint8, uint256) - external - pure - returns ( - uint256, - uint256, - uint256 - ) - { + function calculateRewardShare(uint8, uint256) external pure returns (uint256, uint256, uint256) { return (0.9 ether, 0.05 ether, 0.05 ether); } } diff --git a/test/mocks/SDCollateralMock.sol b/test/mocks/SDCollateralMock.sol index 7c66fc86..d0d1448a 100644 --- a/test/mocks/SDCollateralMock.sol +++ b/test/mocks/SDCollateralMock.sol @@ -5,25 +5,13 @@ contract SDCollateralMock { event SDWithdrawn(address indexed operator, uint256 sdAmount); event SDRepaid(address operator, uint256 repayAmount); - function hasEnoughSDCollateral( - address, - uint8, - uint256 - ) external pure returns (bool) { + function hasEnoughSDCollateral(address, uint8, uint256) external pure returns (bool) { return true; } function slashValidatorSD(uint256, uint8) external {} - function getOperatorInfo(address) - external - pure - returns ( - uint8, - uint256, - uint256 - ) - { + function getOperatorInfo(address) external pure returns (uint8, uint256, uint256) { return (1, 1, 1); } @@ -39,7 +27,9 @@ contract SDCollateralMock { return 0; } - function depositSDFromUtilityPool(address, uint256) external {} + function depositSDFromUtilityPool(address _operator, uint256 _sdAmount) external {} + + function transferBackUtilizedSD(address _operator) external {} function reduceUtilizedSDPosition(address, uint256) external {} diff --git a/test/mocks/SDIncentiveControllerMock.sol b/test/mocks/SDIncentiveControllerMock.sol index 20191f8b..d30b8929 100644 --- a/test/mocks/SDIncentiveControllerMock.sol +++ b/test/mocks/SDIncentiveControllerMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/interfaces/ISDIncentiveController.sol'; +import "../../contracts/interfaces/ISDIncentiveController.sol"; contract SDIncentiveControllerMock { function updateRewardForAccount(address) external {} diff --git a/test/mocks/SDUtilityPoolMock.sol b/test/mocks/SDUtilityPoolMock.sol index 8d12f3fe..8ea4b401 100644 --- a/test/mocks/SDUtilityPoolMock.sol +++ b/test/mocks/SDUtilityPoolMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/interfaces/ISDUtilityPool.sol'; +import "../../contracts/interfaces/ISDUtilityPool.sol"; contract SDUtilityPoolMock { function getUtilizerLatestBalance(address) external pure returns (uint256) { diff --git a/test/mocks/StaderInsuranceFundMock.sol b/test/mocks/StaderInsuranceFundMock.sol index ca448351..66030bce 100644 --- a/test/mocks/StaderInsuranceFundMock.sol +++ b/test/mocks/StaderInsuranceFundMock.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/interfaces/IPermissionedPool.sol'; +import "../../contracts/interfaces/IPermissionedPool.sol"; contract StaderInsuranceFundMock { function depositFund() external payable {} function reimburseUserFund(uint256 _amount) external { - IPermissionedPool(msg.sender).receiveInsuranceFund{value: _amount}(); + IPermissionedPool(msg.sender).receiveInsuranceFund{ value: _amount }(); } } diff --git a/test/mocks/StaderOracleMock.sol b/test/mocks/StaderOracleMock.sol index 6fb915c2..f9edec68 100644 --- a/test/mocks/StaderOracleMock.sol +++ b/test/mocks/StaderOracleMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '../../contracts/interfaces/IStaderOracle.sol'; +import "../../contracts/interfaces/IStaderOracle.sol"; contract StaderOracleMock { function getSDPriceInETH() external pure returns (uint256) { diff --git a/test/mocks/StaderTokenMock.sol b/test/mocks/StaderTokenMock.sol index 9244f984..b2d5f9b6 100644 --- a/test/mocks/StaderTokenMock.sol +++ b/test/mocks/StaderTokenMock.sol @@ -1,23 +1,19 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.16; -import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; -import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; -import '@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol'; -import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol'; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; contract StaderTokenMock is ERC20, ERC20Burnable, ERC20Permit, ERC20Votes { - constructor() ERC20('Stader', 'SD') ERC20Permit('Stader') { - _mint(msg.sender, 150000000 * 10**decimals()); + constructor() ERC20("Stader", "SD") ERC20Permit("Stader") { + _mint(msg.sender, 150000000 * 10 ** decimals()); } // The following functions are overrides required by Solidity. - function _afterTokenTransfer( - address from, - address to, - uint256 amount - ) internal override(ERC20, ERC20Votes) { + function _afterTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Votes) { super._afterTokenTransfer(from, to, amount); } diff --git a/test/mocks/StakePoolManagerMock.sol b/test/mocks/StakePoolManagerMock.sol index eb85e2c2..8c62ad6f 100644 --- a/test/mocks/StakePoolManagerMock.sol +++ b/test/mocks/StakePoolManagerMock.sol @@ -16,10 +16,10 @@ contract StakePoolManagerMock { } function getExchangeRate() external pure returns (uint256) { - return 0.8 * 10**18; + return 0.8 * 10 ** 18; } function transferETHToUserWithdrawManager(uint256 _amount) external { - (bool success, ) = payable(msg.sender).call{value: _amount}(''); + (bool success, ) = payable(msg.sender).call{ value: _amount }(""); } } diff --git a/test/mocks/WethMock.sol b/test/mocks/WETHMock.sol similarity index 63% rename from test/mocks/WethMock.sol rename to test/mocks/WETHMock.sol index 4092a0ec..28140fb0 100644 --- a/test/mocks/WethMock.sol +++ b/test/mocks/WETHMock.sol @@ -7,11 +7,7 @@ contract WETHMock { function withdraw(uint256) external {} - function transferFrom( - address src, - address dst, - uint256 wad - ) external returns (bool) { + function transferFrom(address, address, uint256) external returns (bool) { return true; } }