Skip to content

Commit c2eeede

Browse files
committed
Merge remote-tracking branch 'shop/main'
Add shop-contracts.
2 parents be2e318 + 9504b62 commit c2eeede

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+8901
-0
lines changed

.env.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
HARDHAT_RPC_URL=http://127.0.0.1:8545
2+
PRIVATE_KEY=
3+
EON_KEY=
4+
BLOCK_GAS_LIMIT=30_000_000
5+
ETHERSCAN_API_KEY=

.github/workflows/forge-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on: [push]
2+
3+
name: test
4+
5+
jobs:
6+
check:
7+
name: Foundry project
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
submodules: recursive
13+
14+
- name: Install Foundry
15+
uses: foundry-rs/foundry-toolchain@v1
16+
17+
- name: Run tests
18+
run: forge test -vvv
19+
20+
- name: Run snapshot
21+
run: forge snapshot

.github/workflows/pre-commit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: pre-commit
2+
3+
on: [push]
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
submodules: recursive
12+
13+
- uses: actions/setup-python@v3
14+
15+
- name: Install Foundry
16+
uses: foundry-rs/foundry-toolchain@v1
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: "1.21.4"
21+
22+
- name: Install abigen
23+
run: go install github.com/ethereum/go-ethereum/cmd/[email protected]
24+
25+
- uses: pre-commit/[email protected]

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: test
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
FOUNDRY_PROFILE: ci
7+
8+
jobs:
9+
check:
10+
strategy:
11+
fail-fast: true
12+
13+
name: Foundry project
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
submodules: recursive
19+
20+
- name: Install Foundry
21+
uses: foundry-rs/foundry-toolchain@v1
22+
with:
23+
version: nightly
24+
25+
- name: Run Forge build
26+
run: |
27+
forge --version
28+
forge build --sizes
29+
id: build
30+
31+
- name: Run Forge tests
32+
run: |
33+
forge test -vvv
34+
id: test

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
6+
broadcast/
7+
artifacts/
8+
9+
# Docs
10+
docs/
11+
12+
# local development
13+
.direnv
14+
.devenv
15+
16+
# Dotenv file
17+
.env

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts

.pre-commit-config.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
default_language_version:
2+
python: python3
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: check-added-large-files
9+
args: ["--maxkb=1000"]
10+
- id: fix-byte-order-marker
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-toml
14+
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
17+
- repo: https://github.com/pre-commit/mirrors-prettier
18+
rev: v3.0.0-alpha.9-for-vscode
19+
hooks:
20+
- id: prettier
21+
additional_dependencies:
22+
23+
args: ["--plugin=prettier-plugin-solidity"]
24+
types_or:
25+
[
26+
"yaml",
27+
"markdown",
28+
"solidity",
29+
"makefile",
30+
"gitignore",
31+
"toml",
32+
"json",
33+
"javascript",
34+
"proto",
35+
]
36+
37+
- repo: local
38+
hooks:
39+
- id: generate
40+
name: generate
41+
language: system
42+
entry: bash -c 'make gen'
43+
always_run: true
44+
pass_filenames: false
45+
require_serial: true
46+
- id: bindings
47+
name: bindings
48+
language: system
49+
entry: bash -c 'make bindings'
50+
always_run: true
51+
pass_filenames: false
52+
require_serial: true

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pre-commit 3.3.3
2+
golang 1.21.4

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
SHELL := /usr/bin/env bash
2+
3+
lower = $(shell echo '$1' | tr '[:upper:]' '[:lower:]')
4+
5+
CONTRACTS := $(basename $(notdir $(wildcard ./src/*.sol)))
6+
7+
all: forge gen
8+
.PHONY: all forge gen
9+
10+
forge:
11+
forge build
12+
13+
gen:
14+
go run gen/gen.go -config genconfig.toml -base-path ./
15+
16+
$(CONTRACTS:%=bindings/%.go): forge
17+
abigen --abi <(jq '.["abi"]' "out/$(basename $(notdir $@)).sol/$(basename $(notdir $@)).json") --pkg bindings --type $(basename $(notdir $@)) --out $@
18+
19+
bindings: $(CONTRACTS:%=bindings/%.go)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# shop-contracts
2+
3+
## Running the tests
4+
5+
Install [foundry](https://book.getfoundry.sh/getting-started/installation).
6+
7+
Run `forge test -vvv`

0 commit comments

Comments
 (0)