Skip to content

Commit

Permalink
feat: update to use expect
Browse files Browse the repository at this point in the history
  • Loading branch information
vittominacori committed Jan 23, 2023
1 parent e79e4dc commit a285aa0
Show file tree
Hide file tree
Showing 19 changed files with 208 additions and 310 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -16,3 +16,6 @@ indent_size = 4

[*.js]
indent_size = 2

[*.{adoc,md}]
max_line_length = 0
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

42 changes: 16 additions & 26 deletions .eslintrc
@@ -1,30 +1,26 @@
{
"extends" : [
"standard",
"plugin:promise/recommended",
"root": true,
"extends": [
"eslint:recommended",
"prettier"
],
"plugins": [
"mocha-no-only",
"promise",
"mocha-no-only"
],
"env": {
"browser" : true,
"node" : true,
"mocha" : true,
"jest" : true,
"es2022": true,
"browser": true,
"node": true,
"mocha": true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false,
"globals": {
"artifacts": "readonly",
"contract": "readonly",
"web3": "readonly",
"extendEnvironment": "readonly",
"expect": "readonly"
},
"rules": {

// Strict mode
"strict": ["error", "global"],

// Code style
"array-bracket-spacing": ["off"],
"camelcase": ["error", {"properties": "always"}],
"comma-dangle": ["error", "always-multiline"],
Expand All @@ -51,12 +47,6 @@
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],

"mocha-no-only/mocha-no-only": ["error"],

"promise/always-return": "off",
"promise/avoid-new": "off",
},
"parserOptions": {
"ecmaVersion": 2018
"mocha-no-only/mocha-no-only": ["error"]
}
}
9 changes: 6 additions & 3 deletions .gitignore
Expand Up @@ -12,9 +12,9 @@ pids
scTopics

# Coverage directory used by tools like istanbul
/coverage
/coverageEnv
coverage
coverage.json
coverageEnv

# temporary artifact from solidity-coverage
allFiredEvents
Expand All @@ -37,6 +37,9 @@ npm-debug.log
# truffle build directory
/build

# hardat-exposed
contracts-exposed

# Hardhat files
/artifacts
/cache
Expand All @@ -54,5 +57,5 @@ package-lock.json
.idea

# vuepress
docs/.vuepress/dist/
docs/.vuepress/dist
docs/.vuepress/.env.json
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
16
18
5 changes: 3 additions & 2 deletions .prettierrc
@@ -1,12 +1,13 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": "*.sol",
"options": {
"singleQuote": false,
"printWidth": 120
"singleQuote": false
}
}
]
Expand Down
4 changes: 1 addition & 3 deletions .solcover.js
Expand Up @@ -2,7 +2,5 @@ module.exports = {
norpc: true,
testCommand: 'npm run hardhat:test',
compileCommand: 'npm run hardhat:compile',
skipFiles: [
'mocks'
],
skipFiles: ['mocks'],
};
50 changes: 15 additions & 35 deletions README.md
Expand Up @@ -143,70 +143,50 @@ As example: an Implementation of a classic token Crowdsale, but paid with ERC136
npm install
```

### Linter

Use Solhint

```bash
npm run lint:sol
```

Use ESLint

```bash
npm run lint:js
```

Use Eslint and fix

```bash
npm run lint:fix
```

### Usage (using Truffle)
### Usage (using Hardhat)

Open the Truffle console
Open the console

```bash
npm run truffle:console
npm run console
```

#### Compile

```bash
npm run truffle:compile
npm run compile
```

#### Test

```bash
npm run truffle:test
npm test
```

### Usage (using Hardhat)

Open the Hardhat console
#### Code Coverage

```bash
npm run hardhat:console
npm run coverage
```

#### Compile
### Linter

Check Solidity files

```bash
npm run hardhat:compile
npm run lint:sol
```

#### Test
Check JS/TS files

```bash
npm run hardhat:test
npm run lint:js
```

#### Code Coverage
Fix JS and Solidity files

```bash
npm run hardhat:coverage
npm run lint:fix
```

## License
Expand Down
33 changes: 26 additions & 7 deletions docs/.vuepress/config.js
Expand Up @@ -2,21 +2,40 @@ const vars = require('./.env.json');

module.exports = {
title: 'An ERC-20 token that can be used for payments',
description: 'The ERC-1363 is an ERC-20 compatible token that can make a callback on the receiver contract to notify token transfers or token approvals',
description:
'The ERC-1363 is an ERC-20 compatible token that can make a callback on the receiver contract to notify token transfers or token approvals',
base: '/erc1363-payable-token/',
plugins: [
['@vuepress/google-analytics', {
ga: vars.gaId,
}]
[
'@vuepress/google-analytics',
{
ga: vars.gaId,
},
],
],
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:url', content: 'https://vittominacori.github.io/erc1363-payable-token' }],
['meta', { property: 'og:image', content: 'https://vittominacori.github.io/erc1363-payable-token/assets/images/erc1363-payable-token.jpg' }], // eslint-disable-line max-len
[
'meta',
{
property: 'og:image',
content: 'https://vittominacori.github.io/erc1363-payable-token/assets/images/erc1363-payable-token.jpg',
},
],
['meta', { property: 'twitter:card', content: 'summary_large_image' }],
['meta', { property: 'twitter:image', content: 'https://vittominacori.github.io/erc1363-payable-token/assets/images/erc1363-payable-token.jpg' }], // eslint-disable-line max-len
['meta', { property: 'twitter:title', content: 'ERC-1363 Payable Token | An ERC-20 token that can be used for payments' }],
[
'meta',
{
property: 'twitter:image',
content: 'https://vittominacori.github.io/erc1363-payable-token/assets/images/erc1363-payable-token.jpg',
},
],
[
'meta',
{ property: 'twitter:title', content: 'ERC-1363 Payable Token | An ERC-20 token that can be used for payments' },
],
],
themeConfig: {
repo: 'vittominacori/erc1363-payable-token',
Expand Down
13 changes: 4 additions & 9 deletions hardhat.config.js
@@ -1,17 +1,9 @@
require('chai/register-should');
require('@nomiclabs/hardhat-ganache');
require('@nomiclabs/hardhat-truffle5');
require('hardhat-exposed');
require('solidity-coverage');

module.exports = {
defaultNetwork: 'hardhat',
networks: {
coverage: {
url: 'http://127.0.0.1:8555',
gas: 0xfffffffffff,
gasPrice: 0x01,
},
},
solidity: {
version: '0.8.17',
settings: {
Expand All @@ -21,4 +13,7 @@ module.exports = {
},
},
},
exposed: {
exclude: [],
},
};
56 changes: 26 additions & 30 deletions package.json
@@ -1,34 +1,36 @@
{
"name": "erc-payable-token",
"version": "4.8.0",
"version": "4.8.1",
"description": "ERC-1363 Payable Token Implementation",
"files": [
"contracts",
"test"
],
"scripts": {
"truffle:console": "truffle develop",
"truffle:compile": "scripts/compile.sh",
"truffle:test": "npm run truffle:compile && scripts/test.sh",
"truffle:console": "truffle console",
"truffle:compile": "truffle compile --all",
"truffle:test": "truffle test",
"hardhat:console": "hardhat console",
"hardhat:compile": "hardhat compile",
"hardhat:test": "hardhat test",
"hardhat:coverage": "hardhat coverage --network coverage",
"hardhat:coverage": "env COVERAGE=true hardhat coverage",
"console": "npm run hardhat:console",
"compile": "npm run hardhat:compile",
"test": "npm run hardhat:test",
"coverage": "scripts/coverage.sh",
"coverage": "npm run hardhat:coverage",
"clean": "rm -rf coverage",
"profile": "npm run clean && npm run coverage && open coverage/index.html",
"lint": "npm run lint:js && npm run lint:sol",
"lint:fix": "npm run lint:js:fix && npm run lint:sol:fix",
"lint:js": "eslint --ignore-path .gitignore .",
"lint:js:fix": "eslint --ignore-path .gitignore . --fix",
"lint:sol": "solhint 'contracts/**/*.sol' && prettier -c 'contracts/**/*.sol'",
"lint:sol:fix": "prettier --write \"contracts/**/*.sol\"",
"lint:js": "prettier --loglevel warn --ignore-path .gitignore '**/*.{js,ts}' --check && eslint --ignore-path .gitignore .",
"lint:js:fix": "prettier --loglevel warn --ignore-path .gitignore '**/*.{js,ts}' --write && eslint --ignore-path .gitignore . --fix",
"lint:sol": "prettier --loglevel warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --check && solhint '{contracts,test}/**/*.sol'",
"lint:sol:fix": "prettier --loglevel warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --write",
"flat": "scripts/flat.sh",
"analyze": "scripts/analyze.sh",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"docs:deploy": "vuepress build docs && sh docs/deploy/deploy.sh"
"docs:dev": "export NODE_OPTIONS=--openssl-legacy-provider && vuepress dev docs",
"docs:build": "export NODE_OPTIONS=--openssl-legacy-provider && vuepress build docs",
"docs:deploy": "export NODE_OPTIONS=--openssl-legacy-provider && vuepress build docs && sh docs/deploy/deploy.sh"
},
"repository": {
"type": "git",
Expand All @@ -49,32 +51,26 @@
},
"homepage": "https://vittominacori.github.io/erc1363-payable-token",
"dependencies": {
"@openzeppelin/contracts": "4.8.0"
"@openzeppelin/contracts": "4.8.1"
},
"devDependencies": {
"@nomiclabs/hardhat-ganache": "^2.0.1",
"@nomiclabs/hardhat-truffle5": "^2.0.7",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/test-helpers": "^0.5.16",
"@vuepress/plugin-google-analytics": "^1.9.7",
"chai": "4.3.4",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.26.0",
"chai": "^4.3.7",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-standard": "^5.0.0",
"ganache-cli": "^6.12.2",
"hardhat": "^2.12.2",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "^1.0.0-rc.1",
"sol2uml": "^2.2.6",
"solhint": "^3.3.7",
"hardhat": "^2.12.6",
"hardhat-exposed": "^0.3.0",
"prettier": "^2.8.3",
"prettier-plugin-solidity": "^1.1.1",
"sol2uml": "^2.4.2",
"solhint": "^3.3.8",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.8.2",
"surya": "^0.4.6",
"truffle": "^5.6.4",
"truffle": "^5.7.3",
"vuepress": "^1.9.7"
}
}
7 changes: 0 additions & 7 deletions scripts/compile.sh

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/coverage.sh

This file was deleted.

0 comments on commit a285aa0

Please sign in to comment.