Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJurassicPunk committed Apr 12, 2022
0 parents commit b585abd
Show file tree
Hide file tree
Showing 25 changed files with 10,907 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json
typechain
lib/ds-test
27 changes: 27 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": false,
"es2021": true,
"mocha": true,
"node": true
},
"plugins": ["@typescript-eslint"],
"extends": [
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:node/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"node/no-unsupported-features/es-syntax": ["error", { "ignores": ["modules"] }]
},
"settings": {
"node": {
"tryExtensions": [".js", ".json", ".ts", ".d.ts"]
}
}
}
36 changes: 36 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Format and lint checks

on:
pull_request:
push:
branches:
- master

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run format checks
run: yarn format:check
- name: Run lint
run: yarn lint
42 changes: 42 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests

on:
pull_request:
push:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dev dependencies
run: yarn install --frozen-lockfile
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Compile code (Hardhat)
run: yarn compile:force
- name: Run TypeScript/Waffle tests
run: yarn test
- name: Run Solidity/Forge tests
run: forge test
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.env
.env*
coverage
coverage.json
typechain
.DS_Store

# Hardhat files
cache
artifacts
abis/

# Others
lib
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
yarn format:check
18 changes: 18 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
node_modules
.env
.env*
coverage
coverage.json
typechain

# Hardhat files
cache
artifacts

hardhat.config.ts
contracts/test
test/

# Others
lib
.DS_Store
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json
typechain
lib/ds-test
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 120
}
7 changes: 7 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
silent: true,
measureStatementCoverage: true,
measureFunctionCoverage: true,
skipFiles: ["interfaces", "test"],
configureYulOptimizer: true,
};
10 changes: 10 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.0"],
"func-visibility": [{ "ignoreConstructors": true }],
"func-name-mixedcase": "off",
"reason-string": "off",
"var-name-mixedcase": "off"
}
}
4 changes: 4 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
test
demo.sol
*.t.sol
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 LooksRare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Solidity template

This is a template for GitHub repos with Solidity smart contracts using Forge and Hardhat.
18 changes: 18 additions & 0 deletions contracts/Greeter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

contract Greeter {
string private greeting;

constructor(string memory _greeting) {
greeting = _greeting;
}

function greet() public view returns (string memory) {
return greeting;
}

function setGreeting(string memory _greeting) public {
greeting = _greeting;
}
}
36 changes: 36 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[default]
auto_detect_solc = true
block_base_fee_per_gas = 0
block_coinbase = '0x0000000000000000000000000000000000000000'
block_difficulty = 0
block_number = 0
block_timestamp = 0
cache = true
cache_path = 'cache'
evm_version = 'london'
extra_output = []
extra_output_files = []
ffi = false
force = false
fuzz_max_global_rejects = 65536
fuzz_max_local_rejects = 1024
fuzz_runs = 1000
gas_limit = 9223372036854775807
gas_price = 0
gas_reports = ['*']
ignored_error_codes = [1878]
initial_balance = '0xffffffffffffffffffffffff'
libraries = []
libs = ['node_modules']
names = false
offline = false
optimizer = true
optimizer_runs = 888888
out = 'artifacts'
sender = '0x00a329c0648769a73afac7f9381e08fb43dbea72'
sizes = false
src = 'contracts'
test = 'test'
tx_origin = '0x00a329c0648769a73afac7f9381e08fb43dbea72'
verbosity = 0
via_ir = false
65 changes: 65 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import type { HardhatUserConfig } from "hardhat/types";
import { task } from "hardhat/config";

import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-waffle";
import "@typechain/hardhat";
import "hardhat-abi-exporter";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "dotenv/config";

task("accounts", "Prints the list of accounts", async (_args, hre) => {
const accounts = await hre.ethers.getSigners();
accounts.forEach(async (account) => console.info(account.address));
});

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
allowUnlimitedContractSize: false,
hardfork: "berlin", // Berlin is used (temporarily) to avoid issues with coverage
mining: {
auto: true,
interval: 50000,
},
gasPrice: "auto",
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_KEY,
},
solidity: {
compilers: [
{
version: "0.8.7",
settings: { optimizer: { enabled: true, runs: 888888 } },
},
{
version: "0.4.18",
settings: { optimizer: { enabled: true, runs: 999 } },
},
],
},
paths: {
sources: "./contracts/",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
abiExporter: {
path: "./abis",
runOnCompile: true,
clear: true,
flat: true,
pretty: false,
except: ["test*", "@openzeppelin*", "uniswap*"],
},
gasReporter: {
enabled: !!process.env.REPORT_GAS,
excludeContracts: ["test*", "@openzeppelin*"],
},
};

export default config;
1 change: 1 addition & 0 deletions lib/ds-test
Submodule ds-test added at 0a5da5
Loading

0 comments on commit b585abd

Please sign in to comment.