Skip to content

Commit

Permalink
build!: setup monorepo with turborepo for @lukso/lsp-smart-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Jan 18, 2024
1 parent def913d commit c80c88b
Show file tree
Hide file tree
Showing 46 changed files with 35,874 additions and 20,740 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
ignorePatterns: ['artifacts/', 'cache/', 'dist/', 'types/', 'contracts.ts'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
plugins: ['@typescript-eslint/eslint-plugin', 'prettier'],
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-explicit-any': 'off',
},
};
15 changes: 12 additions & 3 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ jobs:
run: npm ci

- name: 🔍 Run Solidity Linter
run: npm run lint:solidity
run: |
npm run lint:solidity
npm run lint:turbo:solidity
- name: 🎨 Run ESLint on JS/TS files
run: npm run lint
run: |
npm run lint
npm run lint:turbo
# This will also generate the Typechain types used by the Chai tests
- name: 🏗️ Build contract artifacts
run: npx hardhat compile
run: |
npm run build
npm run build:turbo
- name: 📤 cache dependencies + build
uses: actions/cache@v2
Expand All @@ -55,6 +61,9 @@ jobs:
exit 1
fi
- name: 🧪 Run Turbo tests
run: npm run test:turbo

test-suites:
strategy:
matrix:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ gas_benchmark.md

# test temporary folder
/.test

# Turborepo
.turbo
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"options": {
"tabWidth": 4,
"printWidth": 80,
"compiler": "0.8.15"
"compiler": "0.8.17"
}
}
]
Expand Down
9 changes: 9 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
entries: ['./constants'],
declaration: 'compatible', // generate .d.ts files
rollup: {
emitCJS: true,
},
});
1 change: 1 addition & 0 deletions config/eslint-config-custom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `eslint-custom-config`
14 changes: 14 additions & 0 deletions config/eslint-config-custom/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
ignorePatterns: ['artifacts/', 'cache/', 'dist/', 'types/', 'contracts.ts'],
extends: ['turbo', 'prettier'],
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-explicit-any': 'off',
},
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
},
};
13 changes: 13 additions & 0 deletions config/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "eslint-config-custom",
"version": "0.0.0",
"main": "index.js",
"private": true,
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-config-turbo": "^1.9.3",
"eslint-plugin-prettier": "^4.0.0"
}
}
17 changes: 17 additions & 0 deletions config/tsconfig/contracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"target": "ES2019",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"outDir": "dist",
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"lib": ["ES2019", "es2019.array", "ES2021.String"]
},
"include": ["./tests", "hardhat", "./deploy"],
"files": ["./hardhat.config.ts"]
}
11 changes: 11 additions & 0 deletions config/tsconfig/contracts.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "esNext",
"target": "esNext",
"outDir": "module",
"declaration": true,
"skipLibCheck": false
},
"files": ["./constants.ts"]
}
13 changes: 13 additions & 0 deletions config/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "tsconfig",
"version": "0.0.0",
"private": true,
"license": "MIT",
"publishConfig": {
"access": "public"
},
"files": [
"contracts.json",
"contracts.module.json"
]
}
4 changes: 1 addition & 3 deletions contracts/LSP17Extensions/OnERC721ReceivedExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ import {LSP17Extension} from "../LSP17ContractExtension/LSP17Extension.sol";
* to allow it to receive ERC721 tokens via `safeTransferFrom`.
*/
// solhint-disable-next-line no-empty-blocks
contract OnERC721ReceivedExtension is ERC721Holder, LSP17Extension {

}
contract OnERC721ReceivedExtension is ERC721Holder, LSP17Extension {}
19 changes: 16 additions & 3 deletions docs/contracts/ERC725/ERC725.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,12 @@ mapping(bytes32 => bytes) _store
:::

```solidity
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 value, bytes32 indexed salt);
event ContractCreated(
uint256 indexed operationType,
address indexed contractAddress,
uint256 value,
bytes32 indexed salt
);
```

_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._
Expand Down Expand Up @@ -781,7 +786,12 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
:::

```solidity
event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector);
event Executed(
uint256 indexed operationType,
address indexed target,
uint256 value,
bytes4 indexed selector
);
```

_Called address `target` using `operationType` with `value` wei and `data`._
Expand Down Expand Up @@ -811,7 +821,10 @@ Emitted when calling an address `target` (EOA or contract) with `value`.
:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
```

#### Parameters
Expand Down
32 changes: 27 additions & 5 deletions docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,12 @@ function _revertWithLSP20DefaultError(
:::

```solidity
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 value, bytes32 indexed salt);
event ContractCreated(
uint256 indexed operationType,
address indexed contractAddress,
uint256 value,
bytes32 indexed salt
);
```

_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._
Expand Down Expand Up @@ -1349,7 +1354,12 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
:::

```solidity
event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector);
event Executed(
uint256 indexed operationType,
address indexed target,
uint256 value,
bytes4 indexed selector
);
```

_Called address `target` using `operationType` with `value` wei and `data`._
Expand Down Expand Up @@ -1400,7 +1410,10 @@ Emitted when the ownership of the contract has been renounced.
:::

```solidity
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferStarted(
address indexed previousOwner,
address indexed newOwner
);
```

_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._
Expand Down Expand Up @@ -1428,7 +1441,10 @@ Emitted when [`transferOwnership(..)`](#transferownership) was called and the fi
:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
```

#### Parameters
Expand Down Expand Up @@ -1473,7 +1489,13 @@ Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step p
:::

```solidity
event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 indexed typeId, bytes receivedData, bytes returnedValue);
event UniversalReceiver(
address indexed from,
uint256 indexed value,
bytes32 indexed typeId,
bytes receivedData,
bytes returnedValue
);
```

\*Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,10 @@ _Emitted when changing the guardian threshold_
:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
```

#### Parameters
Expand All @@ -677,7 +680,12 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
:::

```solidity
event RecoveryProcessSuccessful(uint256 indexed recoveryCounter, address indexed newController, bytes32 indexed newSecretHash, address[] guardians);
event RecoveryProcessSuccessful(
uint256 indexed recoveryCounter,
address indexed newController,
bytes32 indexed newSecretHash,
address[] guardians
);
```

_Emitted when the recovery process is finished by the controller who reached the guardian threshold and submitted the string that produce the secretHash_
Expand Down Expand Up @@ -730,7 +738,11 @@ _Emitted when changing the secret hash_
:::

```solidity
event SelectedNewController(uint256 indexed recoveryCounter, address indexed guardian, address indexed addressSelected);
event SelectedNewController(
uint256 indexed recoveryCounter,
address indexed guardian,
address indexed addressSelected
);
```

_Emitted when a guardian select a new potentiel controller address for the target_
Expand Down
10 changes: 8 additions & 2 deletions docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ Emitted when the ownership of the contract has been renounced.
:::

```solidity
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferStarted(
address indexed previousOwner,
address indexed newOwner
);
```

_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._
Expand Down Expand Up @@ -368,7 +371,10 @@ Emitted when [`transferOwnership(..)`](#transferownership) was called and the fi
:::

```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
```

#### Parameters
Expand Down
Loading

0 comments on commit c80c88b

Please sign in to comment.