Skip to content

Commit

Permalink
πŸŽ‰ contracts: create workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Dec 18, 2023
1 parent 1cdc3d1 commit 2924865
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
"unicorn/filename-case": "off", // use default export name
"unicorn/prefer-top-level-await": "off", // unsupported in react-native
},
ignorePatterns: ["build/", "dist/", ".expo/types/**/*.ts", "expo-env.d.ts"],
ignorePatterns: ["build/", "dist/", ".expo/types/**/*.ts", "expo-env.d.ts", "contracts/lib/"],
overrides: [
{
files: [...nodeFiles, "pomelo/**"],
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: foundry-rs/foundry-toolchain@v1
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
cache-dependency-path: contracts/requirements.txt
- run: pip install -r contracts/requirements.txt
- run: bun install
- run: bun run test
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/lib/light-account"]
path = contracts/lib/light-account
url = https://github.com/alchemyplatform/light-account
Binary file modified bun.lockb
Binary file not shown.
9 changes: 9 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cache/
docs/
out/

!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

.env
6 changes: 6 additions & 0 deletions contracts/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "solhint:recommended",
"rules": {
"func-visibility": ["error", { "ignoreConstructors": true }]
}
}
10 changes: 10 additions & 0 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[profile.default]
solc = "0.8.23"
optimizer = true
optimizer_runs = 200
verbosity = 3

[fmt]
tab_width = 2
bracket_spacing = true
number_underscore = "thousands"
1 change: 1 addition & 0 deletions contracts/lib/forge-std
Submodule forge-std added at 155d54
1 change: 1 addition & 0 deletions contracts/lib/light-account
Submodule light-account added at 61e607
15 changes: 15 additions & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@exactly/contracts",
"scripts": {
"test": "concurrently 'npm:test:*' --group -c auto",
"test:fmt": "forge fmt --check",
"test:forge": "forge test",
"test:solhint": "solhint '{src,script,test}/**/*.sol'",
"test:slither": "slither .",
"prepare": "git submodule update --init --recursive"
},
"devDependencies": {
"concurrently": "^8.2.2",
"solhint": "^4.0.0"
}
}
2 changes: 2 additions & 0 deletions contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
light-account/=lib/light-account/src/
forge-std/=lib/forge-std/src/
1 change: 1 addition & 0 deletions contracts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
slither-analyzer==0.10.0
4 changes: 4 additions & 0 deletions contracts/slither.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"detectors_to_exclude": "solc-version,naming-convention",
"filter_paths": "lib/"
}
8 changes: 8 additions & 0 deletions contracts/src/Account.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.23;

import { LightAccount, IEntryPoint } from "light-account/LightAccount.sol";

contract Account is LightAccount {
constructor(IEntryPoint anEntryPoint) LightAccount(anEntryPoint) { }
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"test": "concurrently 'npm:test:*' --group -c auto",
"test:ts:expo": "tsc",
"test:ts:node": "tsc -p tsconfig.node.json",
"test:contracts": "bun run --cwd contracts test",
"test:pomelo": "bun run --cwd pomelo test",
"test:eslint": "eslint --max-warnings=0 ."
},
"workspaces": [
"contracts",
"pomelo",
"webauthn"
],
Expand Down
12 changes: 11 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
"noUncheckedIndexedAccess": true
},
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"],
"exclude": ["**/node_modules", "**/build", "**/dist", ".tamagui", "*.config.ts", "pomelo", "webauthn", ".vercel"]
"exclude": [
"contracts",
"pomelo",
"webauthn",
"**/node_modules",
"**/build",
"**/dist",
"*.config.ts",
".tamagui",
".vercel"
]
}

0 comments on commit 2924865

Please sign in to comment.