Skip to content

Commit

Permalink
Upgrade ecosystems (#1013)
Browse files Browse the repository at this point in the history
* upgrade ecosystems

* use node 18.x

* remove "type: module"
  • Loading branch information
aggre authored Jul 9, 2024
1 parent f6c9bdc commit 5c44a7e
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 5,894 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

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

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ types

# output of tsc
*.js
*.cjs
!truffle-config.js
!eslint.config.js

# use yarn
package-lock.json
Expand Down
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"semi": false,
"singleQuote": true,
"useTabs": true,
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": ["*.sol"],
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"rules": {
"no-empty-blocks": "off",
"compiler-version": ["error", "0.8.9"],
"compiler-version": ["error", "=0.8.24"],
"func-visibility": ["warn", { "ignoreConstructors": true }]
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
6 changes: 0 additions & 6 deletions contracts/Admin.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/Example.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
pragma solidity =0.8.9;
pragma solidity =0.8.24;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

Expand Down
12 changes: 0 additions & 12 deletions contracts/UpgradeableProxy.sol

This file was deleted.

33 changes: 33 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export default {
ignores: ['node_modules/', 'types/', 'typechain-types/'],
env: {
mocha: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: '.',
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'xo',
'xo-typescript',
'prettier',
],
rules: {
'@typescript-eslint/prefer-readonly-parameter-types': 'warn',
},
overrides: [
{
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/naming-convention': 'off',
},
},
],
}
14 changes: 6 additions & 8 deletions hardhat.config.ts → hardhat.config.cts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import '@typechain/hardhat'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'
import '@nomiclabs/hardhat-etherscan'
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
import '@openzeppelin/hardhat-upgrades'
import { type HardhatUserConfig } from 'hardhat/config'
import * as dotenv from 'dotenv'

dotenv.config()
Expand All @@ -12,7 +10,7 @@ const mnemnoc =

const config: HardhatUserConfig = {
solidity: {
version: '0.8.9',
version: '0.8.24',
settings: {
optimizer: {
enabled: true,
Expand Down Expand Up @@ -56,10 +54,10 @@ const config: HardhatUserConfig = {
apiKey: {
...((k) => (k ? { mainnet: k } : undefined))(process.env.ETHERSCAN_KEY),
...((k) => (k ? { arbitrumOne: k, arbitrumTestnet: k } : undefined))(
process.env.ARBISCAN_KEY
process.env.ARBISCAN_KEY,
),
...((k) => (k ? { polygon: k, polygonMumbai: k } : undefined))(
process.env.POLYGONSCAN_KEY
process.env.POLYGONSCAN_KEY,
),
},
},
Expand Down
62 changes: 32 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "template-repos-ts-sol",
"version": "1.0.0",
"description": "Template repository for using TypeScript and Solidity",
"main": "index.js",
"scripts": {
"test": "hardhat test",
"pretest": "yarn generate",
"generate": "hardhat compile",
"pregenerate": "yarn clean",
"lint": "yarn lint:eslint && yarn lint:solhint && yarn lint:format",
"lint:eslint": "eslint . --ext .ts --fix",
"lint:eslint": "eslint **/*.ts --fix",
"lint:solhint": "solhint --fix --max-warnings 0 \"contracts/**/*.sol\"",
"lint:format": "prettier --write '**/*.{sol,ts,json,md,yml}'",
"build": "tsc -p tsconfig.build.json",
Expand All @@ -20,38 +19,41 @@
"author": "",
"license": "MPL-2.0",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.8",
"@nomiclabs/hardhat-waffle": "2.0.6",
"@openzeppelin/contracts": "4.8.2",
"@types/chai": "4.3.14",
"@types/dotenv": "8.2.0",
"@types/mocha": "10.0.6",
"@types/node": "20.11.25",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"chai": "4.4.1",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
"@nomicfoundation/hardhat-ethers": "^3.0.6",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.11",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.8",
"@nomicfoundation/ignition-core": "^0.15.5",
"@openzeppelin/contracts": "5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@openzeppelin/hardhat-upgrades": "^3.2.0",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.7",
"@types/node": "20.14.10",
"@typescript-eslint/eslint-plugin": "7.16.0",
"@typescript-eslint/parser": "7.16.0",
"chai": "4",
"del-cli": "5.1.0",
"dotenv": "16.4.5",
"eslint": "8.57.0",
"eslint": "9.6.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-xo": "0.43.1",
"eslint-config-xo-typescript": "1.0.1",
"ethereum-waffle": "4.0.10",
"ethers": "5.7.2",
"hardhat": "2.19.5",
"husky": "8.0.3",
"mocha": "10.3.0",
"prettier": "2.8.8",
"eslint-config-xo": "0.45.0",
"eslint-config-xo-typescript": "4.0.0",
"ethers": "6.13.1",
"hardhat": "2.22.6",
"hardhat-gas-reporter": "^2.2.0",
"husky": "9.0.11",
"prettier": "3.3.2",
"prettier-plugin-solidity": "1.3.1",
"solhint": "^5.0.1",
"solidity-coverage": "^0.8.12",
"ts-node": "10.9.2",
"typescript": "5.4.2"
},
"dependencies": {
"@openzeppelin/contracts-upgradeable": "^4.4.2",
"@typechain/ethers-v5": "^11.0.0",
"@typechain/hardhat": "^7.0.0",
"solhint": "^4.0.0",
"typechain": "^8.0.0"
"typechain": "^8.3.2",
"typescript": "5.5.3"
}
}
4 changes: 4 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{
"matchPackagePatterns": ["*"],
"automerge": true
},
{
"packageNames": ["chai"],
"allowedVersions": "< 5.0.0"
}
]
}
20 changes: 6 additions & 14 deletions scripts/deploy-example.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { ethers } from 'hardhat'
import { deployAdmin, deployProxy } from './utils'
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { ethers, upgrades } from 'hardhat'

async function main() {
const exampleContract = await ethers.getContractFactory('Example')
const example = await exampleContract.deploy()
const example = await upgrades.deployProxy(exampleContract)
await example.waitForDeployment()

const admin = await deployAdmin()

const upgradeableProxy = await deployProxy(
example.address,
admin.address,
ethers.utils.arrayify('0x')
)

console.log('Example address:', example.address)
console.log('Admin address:', admin.address)
console.log('UpgradeableProxy address:', upgradeableProxy.address)
console.log('Example address:', await example.getAddress())
}

main()
Expand Down
31 changes: 0 additions & 31 deletions scripts/utils.ts

This file was deleted.

Loading

0 comments on commit 5c44a7e

Please sign in to comment.