Skip to content

Commit

Permalink
Migrating to hardhat (#21)
Browse files Browse the repository at this point in the history
* setup hardhart project

* bumped up to 0.8x and using latest oz deps

* setup unit tests

* checked in yarn release

* code review fix

* deleted flattened geyser files
  • Loading branch information
aalavandhan authored Nov 14, 2024
1 parent 82e761c commit 2c08ab2
Show file tree
Hide file tree
Showing 54 changed files with 156,772 additions and 42,368 deletions.
2 changes: 0 additions & 2 deletions .coveralls.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
artifacts
cache
coverage
110 changes: 44 additions & 66 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,46 @@
module.exports = {
"extends": ["google", "standard", "plugin:prettier/recommended", "mocha"],
"env": {
"mocha": true,
"node": true,
"es6": true,
},
"parserOptions": {
"ecmaVersion": 8,
},
"globals": {
"artifacts": true,
"assert": true,
"contract": true,
"expect": true,
"Promise": true,
"web3": true,
},
"plugins": ["prettier", "spellcheck", "chai-friendly"],
"rules": {
"prettier/prettier": 0,
"require-jsdoc": 0,
"semi": [2, "always"],
"prefer-const": 2,
"no-unused-expressions": 0,
"chai-friendly/no-unused-expressions": 2,
"spellcheck/spell-checker": [
2,
{
"comments": true,
"strings": true,
"identifiers": true,
"lang": "en_US",
"skipWords": [
// misc
"deployer", "http", "https", "github", "chai", "argv", "evm",
"jsonrpc", "timestamp", "uint256", "erc20", "bignumber", "lodash",
"arg", "npm", "seedrandom", "eql", "sinon", "yaml", "posix", "promisify",
"passcode", "geth", "rpc", "rpcmsg","stdev", "stochasm", "aggregator",
"whitelist", "ethereum", "npx", "testrpc", "solc", "whitelisted",
"unlockable", "openzeppelin", "checksum", "unstakes", "txfee",
"relayer", "gsn", 'struct',

// shorthand
"eth", "args", "util", "utils", "msg", "prev", "bal",
"init", "params", "mul", "async", "vals", "fns", "addrs",
"fns", "num", "dev", "pre","abi", "gte","rnd", "chk", "bals", "lte",
"addr", "perc", "opcode", "aprox", "str",

// project-specific
"rebase", "gons", "frg", "rng", "blockchain", "minlot",
"redemptions", "rebased", "ganache", "ethclient",
"bytecode", "Binance", "ampl", "unstake", "unstaked", "unstaking",
"ampls", "staker", "ownable",

// names
"nithin", "naguib"
],
"skipIfMatch": [
"http(s)?://[^s]*",
"Sha3",
"0x*",
],
"minLength": 3
}
],
},
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
plugins: ["@typescript-eslint", "no-only-tests", "unused-imports"],
extends: ["standard", "plugin:prettier/recommended", "plugin:node/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
warnOnUnsupportedTypeScriptVersion: false,
},
rules: {
"node/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
"node/no-missing-import": [
"error",
{
tryExtensions: [".ts", ".js", ".json"],
},
],
"node/no-unpublished-import": [
"error",
{
allowModules: [
"hardhat",
"ethers",
"@openzeppelin/upgrades-core",
"chai",
"@nomicfoundation/hardhat-ethers",
"@nomicfoundation/hardhat-chai-matchers",
"@nomicfoundation/hardhat-verify",
"@nomicfoundation/hardhat-toolbox",
"@openzeppelin/hardhat-upgrades",
"solidity-coverage",
"hardhat-gas-reporter",
"dotenv",
],
},
],
"no-only-tests/no-only-tests": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": ["warn", { vars: "all" }],
},
};
File renamed without changes.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
42 changes: 42 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Nightly

on:
schedule:
- cron: '0 0 * * *'

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [20.x]
os: [ubuntu-latest]

steps:
- name: Setup Repo
uses: actions/checkout@v4

- name: Uses node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: yarn install --immutable

- name: Seutp
run: yarn compile

- name: Lint
run: yarn lint

- name: Test
run: yarn coverage

- name: spot-contracts report coverage
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage/lcov.info"
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [20.x]
os: [ubuntu-latest]

steps:
- name: Setup Repo
uses: actions/checkout@v4

- name: Uses node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: yarn install --immutable

- name: Seutp
run: yarn compile

- name: Lint
run: yarn lint

- name: Test
run: yarn test
82 changes: 11 additions & 71 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@
# Generated files
build
dist
node_modules
.env

### Emacs ##
*~
\#*\#
.\#*
# Hardhat files
/cache
/artifacts

#
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
#
# TypeChain files
/typechain
/typechain-types

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# solidity-coverage files
/coverage
/coverage.json

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# NodeJS dependencies
node_modules/*

# ES-Lint
.eslintcache

# Solidity-Coverage
allFiredEvents
scTopics
scDebugLog
coverage.json
coverage/
coverageEnv/

.openzeppelin
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# folders
artifacts/
build/
cache/
coverage/
dist/
lib/
node_modules/
typechain/

# files
coverage.json
17 changes: 17 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine":"auto",
"printWidth": 90,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"overrides": [
{
"files": "*.sol",
"options": {
"tabWidth": 4
}
}
]
}
6 changes: 1 addition & 5 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
module.exports = {
norpc: true,
testCommand: 'npm test',
compileCommand: 'npm run compile-contracts',
copyPackages: ['openzeppelin-eth', 'openzeppelin-solidity', 'uFragments'],
skipFiles: ['IStaking.sol'],
skipFiles: ["_test", "_interfaces", "_external"],
};
8 changes: 6 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": "solhint:default",
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["warn", "^0.8.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"reason-string": ["warn", { "maxLength": 64 }],
"not-rely-on-time": "off",
"indent": ["warn", 4]
"max-states-count": ["warn", 17],
"custom-errors": "off"
}
}
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 2c08ab2

Please sign in to comment.