Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: refactor test files with ts and typechain #46

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ebbd2c5
add project coding style dot files
xiaok Jun 1, 2022
0167191
configure typechain and abiExporter
xiaok Jun 1, 2022
1722cb6
refactor: test pool creation
xiaok Jun 6, 2022
52f49dc
test refactor
fengshanshan Jun 8, 2022
d43d6fc
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
fengshanshan Jun 8, 2022
b7be859
refactor: test pool availability
xiaok Jun 8, 2022
241f624
test file to ts
fengshanshan Jun 9, 2022
2ac9f30
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
fengshanshan Jun 9, 2022
c382c83
refactor: test pool swap
xiaok Jun 9, 2022
0826dda
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
xiaok Jun 9, 2022
f3549d7
refactor: test pool claim
xiaok Jun 9, 2022
79c1756
refactor: merge testTokenA/B/C to one contract
xiaok Jun 9, 2022
42302ae
testAfterExpired bug fix
fengshanshan Jun 9, 2022
aad1622
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
fengshanshan Jun 9, 2022
08420c3
format contracts
xiaok Jun 9, 2022
58f02f6
test file fix bugs
fengshanshan Jun 10, 2022
f524572
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
fengshanshan Jun 10, 2022
247cd24
remove unnecessary import
fengshanshan Jun 10, 2022
a77a1b8
TestAfterExpired fix bug
fengshanshan Jun 10, 2022
5a316ea
fix the time advanced
fengshanshan Jun 13, 2022
d85eef9
move getVersion to helper
fengshanshan Jun 13, 2022
e243f5c
fix getVersion
fengshanshan Jun 13, 2022
5d861ae
improve code style
xiaok Jun 13, 2022
01b9d98
variable declaim
fengshanshan Jun 13, 2022
d97edf2
impovement: Uniform CamelCase
xiaok Jun 13, 2022
beac2a3
Merge branch 'ito-refactor' of github.com:DimensionDev/InitialTwitter…
xiaok Jun 13, 2022
2dc35f6
fix ci workflow
xiaok Jun 13, 2022
9183f76
update SmartContractProjectConfig version
xiaok Jun 14, 2022
9d03945
refactor: generateReadme script
xiaok Jun 14, 2022
81c85d9
bug fixes & fix review comments
xiaok Jun 14, 2022
0143677
fix review comments
xiaok Jun 14, 2022
36ae9d3
remove useless test case
xiaok Jun 15, 2022
a596c30
big Number format
fengshanshan Jun 15, 2022
e5bfda6
remove useless type cast
fengshanshan Jun 15, 2022
ec70887
remove useless type cast
fengshanshan Jun 15, 2022
bc6117f
review suggestion
fengshanshan Jun 16, 2022
eec98ab
review suggestion
fengshanshan Jun 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space

[*.sol]
indent_size = 4
89 changes: 89 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "https://dimensiondev.github.io/eslint-plugin/src/schema.json",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@dimensiondev", "@typescript-eslint"],
"rules": {
"eqeqeq": ["error", "smart"],
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-irregular-whitespace": [
"warn",
{
"skipComments": true,
"skipRegExps": true
}
],
"@dimensiondev/array/no-implicit-sort": "error",
"@dimensiondev/array/no-unneeded-flat-map": "error",
"@dimensiondev/array/prefer-from": "error",
"@dimensiondev/string/no-interpolation": "error",
"@dimensiondev/string/no-locale-case": "error",
"@dimensiondev/string/no-simple-template-literal": "error",
"@dimensiondev/string/no-unneeded-to-string": "error",
"@dimensiondev/type/no-bigint": "off",
"@dimensiondev/type/no-const-enum": "off",
"@dimensiondev/type/no-force-cast-via-top-type": "error",
"unicorn/no-instanceof-array": "off",
"@dimensiondev/type/no-instanceof-wrapper": "error",
"@dimensiondev/type/no-number-constructor": "error",
"@dimensiondev/type/no-wrapper-type-reference": "error",
"@dimensiondev/type/prefer-return-type-annotation": "error",
"@dimensiondev/unicode/no-bidi": "off",
"@dimensiondev/unicode/no-invisible": "error",
"@dimensiondev/unicode/specific-set": "off",
"@dimensiondev/ban-eslint-disable": "error",
"@dimensiondev/no-builtin-base64": "error",
"@dimensiondev/no-default-error": "error",
"@dimensiondev/no-redundant-variable": "error",
"@dimensiondev/no-single-return": "error",
"@dimensiondev/no-then": "error",
"@dimensiondev/no-timer": "off",
"@dimensiondev/no-top-level": "off",
"@dimensiondev/no-unsafe-date": "error",
"@dimensiondev/prefer-default-export": "off",
"@dimensiondev/prefer-early-return": "error",
"@dimensiondev/prefer-fetch": "error",
"@dimensiondev/prefer-timer-id": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"warn",
{
"default": "array",
"readonly": "array"
}
],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksConditionals": true,
"checksVoidReturn": true
}
],
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreParameters": false,
"ignoreProperties": false
}
],
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": [
"warn",
{
"allowComparingNullableBooleansToTrue": true
}
],
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/restrict-plus-operands": "error"
}
}
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
with:
submodules: 'recursive'
- uses: actions/setup-node@v2
with:
node-version: 15
- run: npm ci
- run: npm run compile
- run: npm run test
- run: npx prettier --list-different ./test/*.js
- run: npx prettier --list-different ./test/*.ts
# `npx hardhat check` does not return error code, even if there are `lint errors` reported.
# Using `grep` to expose error code to `github workflows`
- run: (! npx hardhat check | grep problem)
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ coverage.json
cache
artifacts
project.secret.js
!project.secret.sample.js
.env
.openzeppelin/
deployments/
deployments/
types/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@dimensiondev:registry=https://npm.dimension.im/
28 changes: 23 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
.github/
.git/
package.json
package-lock.json
truffle-config.js
tsconfig.json
README.md
migrations/**

# VSCode personal settings
.vscode/launch.json
.vscode/tasks.json

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variables file
.env
.env.test

# Generated files
artifacts/
cache/
SmartContractProjectConfig/
types/
.openzeppelin
6 changes: 2 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"trailingComma": "all",
"printWidth": 120,
"semi": true,
"singleQuote": true,
"jsxBracketSameLine": true,
"tabWidth": 4,
"useTabs": false
"singleQuote": false,
"jsxBracketSameLine": true
}
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"wayou.vscode-todo-highlight",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"christian-kohler.path-intellisense"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"eslint.format.enable": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"cSpell.language": "en",
"cSpell.enabled": true,
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"editor.tabSize": 2
}
}
110 changes: 56 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,33 +66,33 @@ To prevent a malicious attack, you can set a `swap_start_time` in your custom qu

| Chain | ITO | Dummy Qualification |
| ------------------- | --------------------------------------- | --------------------------------------- |
| Mainnet | [`0xc2CFbF22`][ito-mainnet] | [`0x4dC5f343`][qlf-mainnet] |
| Ropsten | [`0xcdE281B3`][ito-ropsten] | [`0xd5e6434b`][qlf-ropsten] |
| Rinkeby | [`0xBe62f180`][ito-rinkeby] | [`0x8440b99B`][qlf-rinkeby] |
| BSC | [`0x96c7D011`][ito-bsc] | [`0xAb7B1bE4`][qlf-bsc] |
| BSC_test | [`0xbc558E76`][ito-bsc_test] | [`0xaaC2362f`][qlf-bsc_test] |
| Matic | [`0xF9F7C149`][ito-matic] | [`0x2cf91AD8`][qlf-matic] |
| Arbitrum_rinkeby | [`0x9b3649eC`][ito-arbitrum_rinkeby] | [`0xEbd753E6`][qlf-arbitrum_rinkeby] |
| Arbitrum | [`0x71834a3F`][ito-arbitrum] | [`0x913975af`][qlf-arbitrum] |
| xDai | [`0x913975af`][ito-xdai] | [`0x71834a3F`][qlf-xdai] |
| Goerli | [`0x3475255F`][ito-goerli] | [`0x957DCb39`][qlf-goerli] |
| Fantom | [`0x981be454`][ito-fantom] | [`0x83D6b366`][qlf-fantom] |
| Celo | [`0x54a0A221`][ito-celo] | [`0x2cB220F9`][qlf-celo] |
| Avalanche | [`0x02Ea0720`][ito-avalanche] | [`0x54a0A221`][qlf-avalanche] |
| Optimism_kovan | [`0x88edAC7a`][ito-optimism_kovan] | [`0x57E2AAB7`][qlf-optimism_kovan] |
| Optimism | [`0x71834a3F`][ito-optimism] | [`0x913975af`][qlf-optimism] |
| Aurora | [`0x2cf91AD8`][ito-aurora] | [`0x578a7Fee`][qlf-aurora] |
| Fuse | [`0xF9F7C149`][ito-fuse] | [`0x2cf91AD8`][qlf-fuse] |
| Boba | [`0x981be454`][ito-boba] | [`0x83D6b366`][qlf-boba] |
| Moonriver | [`0x981be454`][ito-moonriver] | [`0x83D6b366`][qlf-moonriver] |
| Conflux_espace_test | [`0x83D6b366`][ito-conflux_espace_test] | [`0x96c7D011`][qlf-conflux_espace_test] |
| Conflux_espace | [`0x066804d9`][ito-conflux_espace] | [`0x05ee315E`][qlf-conflux_espace] |
| Harmony | [`0x5B966f3a`][ito-harmony] | [`0x02Ea0720`][qlf-harmony] |
| Harmony_test | [`0x578a7Fee`][ito-harmony_test] | [`0x81246335`][qlf-harmony_test] |
| Metis_test | [`0x71834a3F`][ito-metis_test] | |
| Metis | [`0x5B966f3a`][ito-metis] | |
| Kardia | [`0x224e8327`][ito-kardia] | [`0x0cE6df81`][qlf-kardia] |
| Astar | [`0x1D720657`][ito-astar] | [`0xdd2Cf3fF`][qlf-astar] |
| mainnet | [`0xc2CFbF22`][ito-mainnet] | [`0x4dC5f343`][qlf-mainnet] |
| ropsten | [`0xcdE281B3`][ito-ropsten] | [`0xd5e6434b`][qlf-ropsten] |
| rinkeby | [`0xBe62f180`][ito-rinkeby] | [`0x8440b99B`][qlf-rinkeby] |
| bsc | [`0x96c7D011`][ito-bsc] | [`0xAb7B1bE4`][qlf-bsc] |
| bsc_test | [`0xbc558E76`][ito-bsc_test] | [`0xaaC2362f`][qlf-bsc_test] |
| matic | [`0xF9F7C149`][ito-matic] | [`0x2cf91AD8`][qlf-matic] |
| arbitrum_rinkeby | [`0x9b3649eC`][ito-arbitrum_rinkeby] | [`0xEbd753E6`][qlf-arbitrum_rinkeby] |
| arbitrum | [`0x71834a3F`][ito-arbitrum] | [`0x913975af`][qlf-arbitrum] |
| xdai | [`0x913975af`][ito-xdai] | [`0x71834a3F`][qlf-xdai] |
| goerli | [`0x3475255F`][ito-goerli] | [`0x957DCb39`][qlf-goerli] |
| fantom | [`0x981be454`][ito-fantom] | [`0x83D6b366`][qlf-fantom] |
| celo | [`0x54a0A221`][ito-celo] | [`0x2cB220F9`][qlf-celo] |
| avalanche | [`0x02Ea0720`][ito-avalanche] | [`0x54a0A221`][qlf-avalanche] |
| optimism_kovan | [`0x88edAC7a`][ito-optimism_kovan] | [`0x57E2AAB7`][qlf-optimism_kovan] |
| optimism | [`0x71834a3F`][ito-optimism] | [`0x913975af`][qlf-optimism] |
| aurora | [`0x2cf91AD8`][ito-aurora] | [`0x578a7Fee`][qlf-aurora] |
| fuse | [`0xF9F7C149`][ito-fuse] | [`0x2cf91AD8`][qlf-fuse] |
| boba | [`0x981be454`][ito-boba] | [`0x83D6b366`][qlf-boba] |
| moonriver | [`0x981be454`][ito-moonriver] | [`0x83D6b366`][qlf-moonriver] |
| conflux_espace_test | [`0x83D6b366`][ito-conflux_espace_test] | [`0x96c7D011`][qlf-conflux_espace_test] |
| conflux_espace | [`0x066804d9`][ito-conflux_espace] | [`0x05ee315E`][qlf-conflux_espace] |
| harmony | [`0x5B966f3a`][ito-harmony] | [`0x02Ea0720`][qlf-harmony] |
| harmony_test | [`0x578a7Fee`][ito-harmony_test] | [`0x81246335`][qlf-harmony_test] |
| metis_test | [`0x71834a3F`][ito-metis_test] | |
| metis | [`0x5B966f3a`][ito-metis] | |
| kardia | [`0x224e8327`][ito-kardia] | [`0x0cE6df81`][qlf-kardia] |
| astar | [`0x1D720657`][ito-astar] | [`0xdd2Cf3fF`][qlf-astar] |

[ito-mainnet]: https://etherscan.io/address/0xc2CFbF22d6Dc87D0eE18d38d73733524c109Ff46
[ito-ropsten]: https://ropsten.etherscan.io/address/0xcdE281B32b629f2e89E5953B674E1E507e6dabcF
Expand Down Expand Up @@ -153,33 +153,35 @@ To prevent a malicious attack, you can set a `swap_start_time` in your custom qu

<!-- begin block -->

| Chain | v1.0 | v2.0 |
| ------------------- | ---------------------- | ---------------------------------- |
| Mainnet | [12689616][v1-mainnet] | [12766513][v2-mainnet] |
| Ropsten | [10468221][v1-ropsten] | [10572050][v2-ropsten] |
| BSC | [8508077][v1-bsc] | [8885927][v2-bsc] |
| Matic | [16002769][v1-matic] | [16516643][v2-matic] |
| Arbitrum_rinkeby | | [708696][v2-arbitrum_rinkeby] |
| Arbitrum | | [102022][v2-arbitrum] |
| xDai | | [17865755][v2-xdai] |
| Goerli | | [6028660][v2-goerli] |
| Fantom | | [25071597][v2-fantom] |
| Celo | | [10406511][v2-celo] |
| Avalanche | | [8289892][v2-avalanche] |
| Optimism_kovan | | [47716][v2-optimism_kovan] |
| Optimism | | [8994][v2-optimism] |
| Aurora | | [57350598][v2-aurora] |
| Fuse | | [14951572][v2-fuse] |
| Boba | | [290600][v2-boba] |
| Moonriver | | [1314566][v2-moonriver] |
| Conflux_espace_test | | [66092470][v2-conflux_espace_test] |
| Conflux_espace | | [37722805][v2-conflux_espace] |
| Harmony | | [24133305][v2-harmony] |
| Harmony_test | | [22744597][v2-harmony_test] |
| Metis_test | | [5207086][v2-metis_test] |
| Metis | | [1701875][v2-metis] |
| Kardia | | [7566530][v2-kardia] |
| Astar | | [915536][v2-astar] |
| Chain | v1.0 | v2.0 |
| ------------------- | ------------------------ | ------------------------------------ |
| mainnet | [`12689616`][v1-mainnet] | [`12766513`][v2-mainnet] |
| ropsten | [`10468221`][v1-ropsten] | [`10572050`][v2-ropsten] |
| rinkeby | | |
| bsc | [`8508077`][v1-bsc] | [`8885927`][v2-bsc] |
| bsc_test | | |
| matic | [`16002769`][v1-matic] | [`16516643`][v2-matic] |
| arbitrum_rinkeby | | [`708696`][v2-arbitrum_rinkeby] |
| arbitrum | | [`102022`][v2-arbitrum] |
| xdai | | [`17865755`][v2-xdai] |
| goerli | | [`6028660`][v2-goerli] |
| fantom | | [`25071597`][v2-fantom] |
| celo | | [`10406511`][v2-celo] |
| avalanche | | [`8289892`][v2-avalanche] |
| optimism_kovan | | [`47716`][v2-optimism_kovan] |
| optimism | | [`8994`][v2-optimism] |
| aurora | | [`57350598`][v2-aurora] |
| fuse | | [`14951572`][v2-fuse] |
| boba | | [`290600`][v2-boba] |
| moonriver | | [`1314566`][v2-moonriver] |
| conflux_espace_test | | [`66092470`][v2-conflux_espace_test] |
| conflux_espace | | [`37722805`][v2-conflux_espace] |
| harmony | | [`24133305`][v2-harmony] |
| harmony_test | | [`22744597`][v2-harmony_test] |
| metis_test | | [`5207086`][v2-metis_test] |
| metis | | [`1701875`][v2-metis] |
| kardia | | [`7566530`][v2-kardia] |
| astar | | [`915536`][v2-astar] |

[v1-mainnet]: https://etherscan.io/block/12689616
[v2-mainnet]: https://etherscan.io/block/12766513
Expand Down
Loading