Skip to content

Commit

Permalink
chore(ethers): change to ethers and updgrade dependencies
Browse files Browse the repository at this point in the history
feat(upgrade): re-create project with hardhat & ethers
removing truffle and web3

chore: re-adds contracts

chore: adds dev rules

chore(contracts): fixes solidity lint errors

chore(test): re-adds tests

chore(upgrade): adds deployment tools

chore(upgrade): add smock for contract mocking

chore(upgrade): removes sol tests

chore(upgrade): fixe pre-commit and update readme

chore(upgrade): add more eslint rules

chore(deps): move typechain to deps

chore(upgrade): unignore dist from npm i

chore(ethers): return util token for manual testing 👿

PP-565: migrate the removeTokens script to use Hardhat and Ethers.js (#92)

* refactor: migrate the removeTokens script to use Hardhat and Ethers.js

* fix: fix the task in hardhat.config, update Readme and apply format

Co-authored-by: Antonio Morrone <antonio@iovlabs.org>

PP-566: migrate script deploy collector (#95)

* feat: dummy commit, create empty deployCollector.ts file

* refactor: add script and task to deploy a Collector using Hardhat and Ethers.js

* style: apply format rules

* test: add the tests, remove the positional arguments and simplify the output file

* fix: apply PR suggestions

Remove some scripts from the package.json
Use console.table to print the collector output
Rename the input config file parameter

Co-authored-by: Antonio Morrone <antonio@iovlabs.org>

PP-569: migrate change partners (#97)

* chore: change package.json version

* feat: migrate the change-partners script to use ether.js

* fix: change the parseJsonFile function to return undefined

* fix: apply PR suggestions

* Revert "style: include automatically formatted solidity files"

This reverts commit 76ee863.

* fix: remove the script from package.json and update Readme.md

* style: apply formatting rules

PP-567 Migrate Withdraw Task (#93)

* feat: new hardhat task

* feat: create withdraw task

* chore: update readme

* feat: complete withdrawal task and tests

* chore: linted

* fix: no from parameter on withdraw

* chore: change readme, description of task

* feat: reorganize tasks and tests

* fix: restore .prepare script

* fix: typo on script

* fix: restore file permissions

* fix: prettier issues, no waffle json file

* fix: no prepare task

* chore: remove unneeded rules

* fix: change Readme.md to fix the command instruction

* fix: restore the collector:deploy sample config file

Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local>
Co-authored-by: Antonio Morrone <antonio@iovlabs.org>

PP-355/update-rif-relay-server (#96)

* refactor(index): expose typing for relay-server

* refactor: prettier

fix: fix the collector and add the missing tests

Fix the collector updateRemainderAddress
Include the missing test for the stakeForAddress method

fix: add config to use custom signers to run scripts (#106)

feat: expiration mechanism (#105)

* feat: expiration mechanism

* fix: FWD to SW

* feat: validate time on deploy

Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local>

PP-602/RelayClient: _validateSmartWallet (#109)

* refactor(SmartWallet): expose getOwner
* refactor(index): expose PromiseOrValue
* chore: github workflow

PP-358: include the contracts in dist (#112)

* fix: remove contracts from npmignore

* chore: rename .prettierrc to prettier.json5 to be consistent among all the repos

PP-357: Add a task to mint utility tokens (#113)

* feat: add a task to mint utility tokens

* fix: apply linting and format to tasks

* refactor: expose RelayHubInterface

* docs: readme

Co-authored-by: Francisco Tobar <francisco.tobar@iovlabs.org>
  • Loading branch information
2 people authored and antomor committed Jan 26, 2023
1 parent 68fa4a4 commit 4e2a5bd
Show file tree
Hide file tree
Showing 153 changed files with 27,948 additions and 65,329 deletions.
49 changes: 49 additions & 0 deletions .commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { UserConfig } from '@commitlint/types';

const Configuration: UserConfig = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
extends: ['@commitlint/config-conventional'],
/*
* Resolve and load conventional-changelog-atom from node_modules.
* Referenced packages must be installed
*/
// parserPreset: 'conventional-changelog-atom',
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
// formatter: '@commitlint/format',
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {},
/*
* Functions that return true if commitlint should ignore the given message.
*/
// ignores: [(commit) => commit === ''],
/*
* Whether commitlint uses the default ignore rules.
*/
// defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
/*
* Custom prompt configs
*/
// prompt: {
// messages: {},
// questions: {
// type: {
// description: 'please input type:',
// },
// },
// },
};

export default Configuration;
6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist
types/truffle-contracts
artifacts
cache
coverage
dist
20 changes: 0 additions & 20 deletions .eslintrc

This file was deleted.

57 changes: 57 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:mocha/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
// root: true,
plugins: ["@typescript-eslint", "mocha"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
tsconfigRootDir: __dirname,
project: "./tsconfig.json",
},
rules: {
"lines-between-class-members": "error",
"padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "*", next: "return" },
],
"prefer-const": [
"error",
{
destructuring: "any",
ignoreReadBeforeAssign: false,
},
],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["variable", "function"],
format: ["camelCase"],
},
{
selector: ["variable"],
modifiers: ["const"],
format: ["camelCase", "UPPER_CASE"],
},
],
"mocha/no-skipped-tests": "warn",
"mocha/no-empty-description": "off",
"mocha/no-exclusive-tests": "error",
"@typescript-eslint/no-unsafe-member-access": "warn",
"eol-last": ["error", "always"]
},
};
78 changes: 28 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,31 @@
name: CI for RIF-Relay-Contract
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'

- name: Install dependencies
run: npm install

- name: Check Linter bugs for Typescript
run: npm run lint:ts

- name: See bugs on solidity
run: npm run lint:sol

- name: Check Codestyles errors
run: npm run prettier

contract-test:
runs-on: ubuntu-latest
needs: [lint]

steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v3

- name: Download rif-relay node configuration
run: |
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/node.conf
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/logback.xml
- name: Run docker image
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest

- name: Install dependencies
run: npm install

# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Run contract test with truffle
run: npm run test:truffle

# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Run contract test with waffle
run: npm run test
lint_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Install dependencies
run: npm install

- name: Check Codestyles errors
run: npm run ci:format

- name: Check Linter bugs for Typescript
run: npm run ci:lint

- name: Download rif-relay node configuration
run: |
wget https://raw.githubusercontent.com/rsksmart/rif-relay/main/docker/node.conf
wget https://raw.githubusercontent.com/rsksmart/rif-relay/main/docker/logback.xml
- name: Run docker image
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest

- name: Run tests
run: npm run ci:test
22 changes: 18 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
node_modules/
build/
dist/
.npmignore
package-lock.json
.eslintcache

node_modules
.env
coverage
coverage.json
typechain
typechain-types

#Hardhat files
cache
artifacts
/build
/dist
/contracts-exposed

.vscode
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
15 changes: 5 additions & 10 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ -d "$HOME/.nvm" ]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi

npm run lint:ts
npm run lint:sol
npm run prettier:fix
npm run format
npm run lint
npx lint-staged
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run build
npm run test
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/.github
/.husky
/scripts
/typechain-types
/test
/utils
/tsconfig.json
/tsconfig.build.json
/index.ts
/hardhat.config.ts
/.commitlintrc.ts
/.eslintignore
/.eslintrc.cjs
/.npmignore
/.prettierignore
/.prettierrc
/.solhint.json
/.solhintignore
!dist
!artifacts
22 changes: 6 additions & 16 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
.gitignore
.prettierignore
package.json
package-lock.json
prettierrc.json5
Readme.md
tsconfig.json
.eslintignore
.eslintrc
node_modules
.solhint.json
.solhintignore
webpack.config.js
build
dist
types/truffle-contracts
pull_request_template.md
artifacts
cache
coverage*
gasReporterOutput.json
typechain-types
dist
28 changes: 20 additions & 8 deletions .prettierrc.json5
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{
trailingComma: 'none',
tabWidth: 4,
semi: true,
singleQuote: true,
jsxSingleQuote: true,
bracketSpacing: true,
jsxBracketSameLine: true,
arrowParens: 'always'
"overrides": [
{
"files": "*.ts",
"options": {
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
},
{
"files": "*.sol",
"options": {
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": false
}
}
]
}
38 changes: 31 additions & 7 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error","^0.6.12"],
"mark-callable-contracts": ["off"],
"reason-string": ["warn",{"maxLength":32}]
}
}
"extends": "solhint:recommended",
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error",
"compiler-version": [
"error",
"^0.6.12"
],
"avoid-suicide": "error",
"avoid-sha3": "warn",
"private-vars-leading-underscore": [
"error",
{
"strict": false
}
],
"code-complexity": [
"error",
7
],
"constructor-syntax": "error",
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
]
}
}
2 changes: 1 addition & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
contracts/0x
node_modules

0 comments on commit 4e2a5bd

Please sign in to comment.