Skip to content

Commit

Permalink
Merge branch 'master' into security-notice
Browse files Browse the repository at this point in the history
  • Loading branch information
mymphe authored Aug 15, 2024
2 parents 1e56e2a + d3b0f40 commit 705b179
Show file tree
Hide file tree
Showing 7 changed files with 1,060 additions and 873 deletions.
38 changes: 0 additions & 38 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/tests-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

services:
hardhat-node:
image: feofanov/hardhat-node:2.22.4
image: feofanov/hardhat-node:2.22.8
ports:
- 8545:8545
env:
Expand Down
65 changes: 65 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// @ts-check
import path from "node:path";
import { fileURLToPath } from "node:url";
import { includeIgnoreFile } from "@eslint/compat";
import js from "@eslint/js";
import ts from "typescript-eslint";
import prettier from "eslint-config-prettier";

import pluginNoOnlyTests from "eslint-plugin-no-only-tests";
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default [
includeIgnoreFile(gitignorePath),
{
ignores: [".solcover.js", "eslint.config.mjs"],
},
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
languageOptions: {
parserOptions: {
ecmaVersion: 2022, sourceType: "module", project: ["./tsconfig.json"],
},
},
plugins: {
"no-only-tests": pluginNoOnlyTests,
"simple-import-sort": pluginSimpleImportSort,
},
rules: {
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-unused-vars": ["warn"],
"@typescript-eslint/no-floating-promises": ["warn"],
"@typescript-eslint/no-shadow": ["error"], // prevents committing `describe.only` and `it.only` tests
"no-only-tests/no-only-tests": "warn",
"no-shadow": "off",
"simple-import-sort/imports": ["error", {
"groups": [["^node:"], ["^\\u0000"], ["^[^@]\\w"], ["^@\\w"], ["^typechain-types"], ["^lib"], ["^test"], ["^../"], ["^./"], ["^"]],
}],
},
},
{
files: [
"scripts/**/*.ts",
"test/**/*.ts",
"lib/protocol/helpers/**/*.ts",
],
languageOptions: {
globals: {
...globals.mocha,
...globals.chai,
},
},
rules: {
"@typescript-eslint/no-unused-expressions": ["off"],
},
},
];


31 changes: 19 additions & 12 deletions lib/protocol/networks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as process from "node:process";

import { log } from "lib";

import { ProtocolNetworkItems } from "./types";

export async function parseLocalDeploymentJson() {
Expand All @@ -8,6 +10,7 @@ export async function parseLocalDeploymentJson() {
// @ts-ignore - file is missing out of the box, that's why we need to catch the error
return await import("../../deployed-local.json");
} catch (e) {
log.error(e as Error);
throw new Error("Failed to parse deployed-local.json. Did you run scratch deploy?");
}
}
Expand Down Expand Up @@ -67,7 +70,7 @@ export async function getNetworkConfig(network: string): Promise<ProtocolNetwork
const defaults = getDefaults(defaultEnv) as Record<keyof ProtocolNetworkItems, string>;

switch (network) {
case "local":
case "local": {
const config = await parseLocalDeploymentJson();
return new ProtocolNetworkConfig(
getPrefixedEnv("LOCAL", defaultEnv),
Expand All @@ -79,20 +82,24 @@ export async function getNetworkConfig(network: string): Promise<ProtocolNetwork
// Overrides for local development
easyTrackAddress: config["app:aragon-agent"].proxy.address,
sdvt: config["app:node-operators-registry"].proxy.address,
});
},
);
}

case "mainnet-fork":
case "hardhat":
const env = getPrefixedEnv("MAINNET", defaultEnv);
return new ProtocolNetworkConfig(env, {
...defaults,
locator: "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb",
// https://docs.lido.fi/deployed-contracts/#dao-contracts
agentAddress: "0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c",
votingAddress: "0x2e59A20f205bB85a89C53f1936454680651E618e",
// https://docs.lido.fi/deployed-contracts/#easy-track
easyTrackAddress: "0xFE5986E06210aC1eCC1aDCafc0cc7f8D63B3F977",
});
return new ProtocolNetworkConfig(
getPrefixedEnv("MAINNET", defaultEnv),
{
...defaults,
locator: "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb",
// https://docs.lido.fi/deployed-contracts/#dao-contracts
agentAddress: "0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c",
votingAddress: "0x2e59A20f205bB85a89C53f1936454680651E618e",
// https://docs.lido.fi/deployed-contracts/#easy-track
easyTrackAddress: "0xFE5986E06210aC1eCC1aDCafc0cc7f8D63B3F977",
},
);

default:
throw new Error(`Network ${network} is not supported`);
Expand Down
35 changes: 20 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"engines": {
"node": ">=20"
},
"packageManager": "yarn@4.3.1",
"packageManager": "yarn@4.4.0",
"scripts": {
"compile": "hardhat compile",
"lint:sol": "solhint 'contracts/**/*.sol'",
"lint:sol:fix": "yarn lint:sol --fix",
"lint:ts": "eslint . --ignore-path .gitignore --max-warnings=0",
"lint:ts": "eslint . --max-warnings=0 --flag unstable_ts_config",
"lint:ts:fix": "yarn lint:ts --fix",
"lint": "yarn lint:sol && yarn lint:ts",
"format": "prettier . --write",
Expand All @@ -32,15 +32,17 @@
},
"lint-staged": {
"./**/*.ts": [
"eslint --ignore-path .gitignore --max-warnings=0"
"eslint --max-warnings=0 --flag unstable_ts_config"
],
"./**/*.{ts,md,json}": [
"prettier --write"
]
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.9.0",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
"@nomicfoundation/hardhat-ethers": "^3.0.6",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
Expand All @@ -51,38 +53,41 @@
"@nomicfoundation/ignition-core": "^0.15.5",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.16",
"@types/chai": "^4.3.17",
"@types/eslint": "^9.6.0",
"@types/eslint__js": "^8.42.3",
"@types/mocha": "10.0.7",
"@types/node": "20.14.13",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@types/node": "20.14.15",
"bigint-conversion": "^2.4.3",
"chai": "^4.5.0",
"chalk": "^4.1.2",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "12.1.1",
"ethereumjs-util": "^7.1.5",
"ethers": "^6.13.2",
"glob": "^10.4.5",
"hardhat": "^2.22.7",
"glob": "^11.0.0",
"globals": "^15.9.0",
"hardhat": "^2.22.8",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.10",
"hardhat-ignore-warnings": "^0.2.11",
"hardhat-tracer": "3.0.3",
"hardhat-tracer": "3.1.0",
"hardhat-watcher": "2.5.0",
"husky": "^9.1.4",
"lint-staged": "^15.2.7",
"lint-staged": "^15.2.8",
"prettier": "^3.3.3",
"solhint": "^5.0.2",
"solhint": "^5.0.3",
"solhint-plugin-lido": "^0.0.4",
"solidity-coverage": "^0.8.12",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typechain": "^8.3.2",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1"
},
"dependencies": {
"@aragon/apps-agent": "2.1.0",
Expand Down
Loading

0 comments on commit 705b179

Please sign in to comment.