Skip to content

Commit

Permalink
Merge pull request #1 from TogetherCrew/ci
Browse files Browse the repository at this point in the history
Ci
  • Loading branch information
cyri113 authored Jul 19, 2024
2 parents 77293a2 + 01c1672 commit e81e7ba
Show file tree
Hide file tree
Showing 18 changed files with 7,286 additions and 4,036 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Continuous Integration

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out the Repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Dependencies
run: yarn install

- name: Clean
run: yarn clean

- name: Compile
run: yarn compile

- name: Check
run: yarn check

- name: Test
run: yarn test

- name: CI
run: yarn ci

- name: Coverage
run: yarn coverage

analyze:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
node-version: 20
sarif: results.sarif
fail-on: none

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,39 @@ node_modules

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337

node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337

node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
yarn clean
yarn compile
yarn check
yarn test
yarn ci
3 changes: 3 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "solhint:default"
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
Binary file added .yarn/install-state.gz
Binary file not shown.
894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.1.cjs
21 changes: 21 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"files": {
"ignore": [
"./typechain-types",
"./artifacts",
"./cache",
"./node_modules",
"./coverage"
]
}
}
2 changes: 1 addition & 1 deletion contracts/Lock.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
pragma solidity ^0.8.24;

// Uncomment this line to use console.log
// import "hardhat/console.sol";
Expand Down
3 changes: 2 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox-viem";
import "@nomiclabs/hardhat-solhint";

const config: HardhatUserConfig = {
solidity: "0.8.26",
solidity: "0.8.24",
};

export default config;
12 changes: 6 additions & 6 deletions ignition/modules/Lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const JAN_1ST_2030 = 1893456000;
const ONE_GWEI: bigint = parseEther("0.001");

const LockModule = buildModule("LockModule", (m) => {
const unlockTime = m.getParameter("unlockTime", JAN_1ST_2030);
const lockedAmount = m.getParameter("lockedAmount", ONE_GWEI);
const unlockTime = m.getParameter("unlockTime", JAN_1ST_2030);
const lockedAmount = m.getParameter("lockedAmount", ONE_GWEI);

const lock = m.contract("Lock", [unlockTime], {
value: lockedAmount,
});
const lock = m.contract("Lock", [unlockTime], {
value: lockedAmount,
});

return { lock };
return { lock };
});

export default LockModule;
58 changes: 32 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
{
"name": "contracts",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/TogetherCrew/contracts.git",
"author": "Cyrille Derche <[email protected]>",
"license": "MIT",
"devDependencies": {
"@ethereum-attestation-service/eas-contracts": "^1.7.1",
"@nomicfoundation/hardhat-ignition": "^0.15.0",
"@nomicfoundation/hardhat-ignition-viem": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomicfoundation/hardhat-viem": "^2.0.0",
"@types/chai": "^4.2.0",
"@types/chai-as-promised": "^7.1.6",
"@types/mocha": ">=9.1.0",
"@types/node": ">=18.0.0",
"chai": "^4.2.0",
"hardhat": "^2.22.6",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"ts-node": ">=8.0.0",
"typescript": "~5.0.4",
"viem": "^2.7.6"
}
"name": "contracts",
"packageManager": "[email protected]",
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@nomicfoundation/hardhat-ignition": "^0.15.0",
"@nomicfoundation/hardhat-ignition-viem": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomicfoundation/hardhat-viem": "^2.0.0",
"@nomiclabs/hardhat-solhint": "^3.1.0",
"@types/chai": "^4.2.0",
"@types/chai-as-promised": "^7.1.6",
"@types/mocha": ">=9.1.0",
"@types/node": ">=18.0.0",
"chai": "^4.2.0",
"hardhat": "^2.14.0",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"ts-node": ">=8.0.0",
"typescript": "~5.0.4",
"viem": "^2.7.6"
},
"scripts": {
"clean": "npx hardhat clean",
"compile": "npx hardhat compile",
"check": "npx hardhat check",
"test": "npx hardhat test",
"coverage": "SOLIDITY_COVERAGE=true npx hardhat coverage",
"ci": "npx biome ci",
"format": "npx biome check --write"
}
}
Loading

0 comments on commit e81e7ba

Please sign in to comment.