Skip to content

Commit

Permalink
The Great TypeScript Refactor (#1069)
Browse files Browse the repository at this point in the history
* TS WIP - testsuites

* tsconfig revamp
* convert testsuites files into TS
* fix up test:contracts:hardhat accordingly

* TS WIP - Typechain

* add typechain for ethereum-contracts

* TS WIP - UUPS and CallUtils

* convert UUPS test and CallUtils test file to typescript

* TS WIP - Utility Contract Tests

* convert utility contract tests to TypeScript
* remove file extension in all-contracts.ts
* add some helpers to helpers.js

* TS WIP - CFAv1Forwarder Tests

* convert CFAv1Forwarder contract tests to TypeScript

* TS WIP - Library Tests

* convert CFAv1Library and IDAv1Library contract tests to TypeScript

* TS WIP - Scenarios Tests

* convert scenarios tests to typescript

* TS WIP - Scenarios Tests

* convert scenarios tests to typescript

* TS WIP - SuperfluidGoverannceII tests

* convert SuperfluidGovernanceII contract tests to TypeScript

* TS WIP - Custom Tokens Tests

* convert custom token contract tests to TypeScript

* TS WIP - Superfluid Core Tests

* convert superfluid core tests to typescript
* use import instead of require in testsuite files

* TS WIP - Clean up commit pollution

* undo some of the variable renaming

* TS WIP - Clean up commit pollution (cont.)

* undo use of ethers over web3

* TS WIP - Clean up commit pollution (cont.)

* TS WIP - Token behavior files

* some cleanup
* mainly converted token behavior files

* TS WIP - CFA/IDA behavior files

* converted behavior files for CFA and IDA

* TS WIP - Convert peripheries

* convert CFADataModel, MFASupport, AgreementHelper, helpers, expectRevert to typescript

* TS WIP - Convert TestEnvironment

* convert TestEnvironment to typescript
* fix MFASupport import
* fix TestEnvironment imports
* remove module.exports from AgreementHelper

* TS WIP - Deprecate JS-SDK

remove js-sdk from:
- pr-artifact creation
- canary tests + coverage
- publish-pr-packages
- publish-release-packages
- codecov flag
- root package.json
- check-changeset.sh

* TS WIP - Add JS-SDK tests

* add tests that exist in js-sdk to sdk-core as part of deprecation

* TS WIP - Packages

* bump hardhat version
* lower js-sdk version

* TS WIP - Refactor Cleanup

* remove most explicit any's + add actual type
* separation of types from actual files in certain places where it is bloated
* BN refactor (passing in BigNumber to almost all funcs)
* .eslintrc.ts.json added to lint typescript test files
* lint fix files
* general type fixes

* remove parallel flag

* bump js-sdk version

* cleanup

* fix naming
* bump solidity-coverage version
* fix dead links

* Split cfa and ida test files

* split CFA and IDA test files into: callback vs non callback and mfa for cfa

* consistent file naming
  • Loading branch information
0xdavinchee authored Sep 8, 2022
1 parent ca3893e commit a30d893
Show file tree
Hide file tree
Showing 60 changed files with 9,885 additions and 8,380 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ your Superfluid smart contracts applications, including [Super Apps](https://doc

Official subgraph for the Superfluid Protocol.

#### [`@superfluid-finance/js-sdk`](https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/js-sdk)
#### [`@superfluid-finance/js-sdk`](https://github.com/superfluid-finance/protocol-monorepo/tree/release-js-sdk-stable/packages/js-sdk)

<p>
<a href="https://www.npmjs.com/package/@superfluid-finance/js-sdk" target="_blank">
Expand All @@ -132,7 +132,7 @@ Official subgraph for the Superfluid Protocol.

:warning: This repo is fully deprecated, use sdk-core instead :warning:

You can get the last release of js-sdk at the branch [here](https://github.com/superfluid-finance/protocol-monorepo/tree/release-js-sdk-stable).
You can get the last release of js-sdk at the branch [here](https://github.com/superfluid-finance/protocol-monorepo/tree/release-js-sdk-stable/packages/js-sdk).

Javascript SDK for building with Superfluid Protocol.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"ethers": "^5.7.0",
"hardhat": "^2.9.9",
"hardhat": "^2.11.0",
"husky": "^8.0.1",
"lerna": "^5.4.3",
"node-jq": "^2.3.3",
Expand Down
9 changes: 8 additions & 1 deletion packages/ethereum-contracts/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"ignorePatterns": ["coverage", "coverage.json", "build", "utils"]
"ignorePatterns": [
"node_modules",
"build",
"coverage",
"coverage.json",
"typechain-types",
"utils"
]
}
49 changes: 49 additions & 0 deletions packages/ethereum-contracts/.eslintrc.ts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"root": false,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"es6": true
},
"plugins": ["import", "eslint-comments", "prettier"],
"extends": [
".eslintrc.json",
"eslint:recommended",
"plugin:eslint-comments/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"eslint-comments/disable-enable-pair": [
"error",
{
"allowWholeFile": true
}
],
"eslint-comments/no-unused-disable": "error",
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc"
}
}
],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"ignoreCase": true
}
],
"prettier/prettier": "error"
}
}
1 change: 1 addition & 0 deletions packages/ethereum-contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/artifacts
/cache
/docs/api
/typechain-types
5 changes: 5 additions & 0 deletions packages/ethereum-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {HardhatUserConfig, subtask} from "hardhat/config";
import "@typechain/hardhat";
import "@nomiclabs/hardhat-web3";
import "@nomiclabs/hardhat-truffle5";
import "@nomicfoundation/hardhat-chai-matchers";
Expand Down Expand Up @@ -74,6 +75,9 @@ const config: HardhatUserConfig = {
},
},
networks: {
hardhat: {
hardfork: "merge"
},
localhost: {
...createNetworkConfig("localhost"),
url: "http://0.0.0.0:8545/",
Expand Down Expand Up @@ -140,6 +144,7 @@ const config: HardhatUserConfig = {
)
: undefined,
},
typechain: {target: "ethers-v5"},
};

export default config;
10 changes: 7 additions & 3 deletions packages/ethereum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"testenv:deploy": "yarn run-truffle exec scripts/deploy-test-environment.js : TEST",
"pretest": "{ yarn testenv:start > /dev/null& } && sleep 5",
"test": "run-s test:*:*",
"test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.js",
"test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.ts",
"test:contracts:foundry": "yarn run-forge test --hardhat",
"test:contracts:solc-compatibility": "test/test-solc-compatibility.sh",
"test:deployment:scripts-js-hardhat": "yarn run-hardhat test test/scripts/deployment.test.js",
Expand All @@ -48,6 +48,10 @@
"lint": "run-s lint:*",
"lint:sol": "solhint -w 0 contracts/*.sol contracts/*/*.sol && echo '✔ Your .sol files look good.'",
"lint:js-eslint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'",
"lint-ts": "eslint test -c .eslintrc.ts.json --ext .ts",
"lint:ts-eslint": "yarn lint-ts --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .ts files look good.'",
"fix": "run-s fix:*",
"fix:eslint": "yarn lint-ts --fix",
"lint:check-no-focused-tests": "grep -FR .only test || { echo 'No test is focused.';exit 0; } && { echo '✘ You have focused tests.'; exit 1; }",
"pre-commit": "if [ ! -z \"$(git status -s .)\" ];then run-s pre-commit:*;else true;fi",
"pre-commit:lint": "yarn lint",
Expand All @@ -65,14 +69,14 @@
"stack-trace": "0.0.10"
},
"devDependencies": {
"@nomiclabs/hardhat-truffle5": "^2.0.6",
"@nomiclabs/hardhat-truffle5": "^2.0.7",
"async": "^3.2.4",
"csv-writer": "^1.6.0",
"ganache-time-traveler": "1.0.16",
"mochawesome": "^7.1.3",
"readline": "1.3.0",
"solhint": "3.3.7",
"solidity-coverage": "0.7.21",
"solidity-coverage": "0.8.0",
"solidity-docgen": "^0.6.0-beta.25",
"truffle-flattener": "^1.6.0",
"truffle-plugin-verify": "0.5.28"
Expand Down
Loading

0 comments on commit a30d893

Please sign in to comment.