Skip to content

Commit 0938a1d

Browse files
authored
Merge pull request #7 from datachainlab/migrate-foundry
Migrate from Truffle to Foundry
2 parents 45ebcc7 + 99fea82 commit 0938a1d

36 files changed

+12849
-12420
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
id: go
1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version: '16'
17+
node-version: '25'
1818

1919
- name: Check out code into the Go module directory
2020
uses: actions/checkout@v3
@@ -23,7 +23,7 @@ jobs:
2323
run: npm install
2424

2525
- name: Setup ganache-cli
26-
run: NO_GEN_CODE=1 ./scripts/setup.sh development
26+
run: NO_GEN_CODE=1 ./script/setup.sh development
2727

2828
- name: Test
2929
run: make test

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
build/
1+
out/
22
node_modules
33
yarn-error.log
4+
broadcast
5+
cache

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ test:
66

77
.PHONY: protogen
88
protogen:
9-
./scripts/protogen.sh
9+
./script/protogen.sh
1010

1111
.PHONY: abi
1212
abi:
1313
ifdef SOURCE
1414
$(eval TARGET := $(shell echo ${SOURCE} | tr A-Z a-z))
15-
@mkdir -p ./build/abi ./pkg/contract
16-
@mkdir -p ./pkg/contract/$(TARGET)
17-
@cat ./build/contracts/${SOURCE}.json | jq ".abi" > ./build/abi/${SOURCE}.abi
18-
$(ABIGEN) --abi ./build/abi/${SOURCE}.abi --pkg $(TARGET) --out ./pkg/contract/$(TARGET)/$(TARGET).go
15+
@mkdir -p ./build/abi ./pkg/contract/$(TARGET)
16+
@cat ./build/$(SOURCE).sol/$(SOURCE).json | jq '.abi' > ./build/abi/$(SOURCE).abi
17+
$(ABIGEN) --abi ./build/abi/$(SOURCE).abi --pkg $(TARGET) --out ./pkg/contract/$(TARGET)/$(TARGET).go
1918
else
20-
@echo "'SOURCE={SOURCE}' is required"
19+
@echo "'SOURCE={ContractName}' is required, e.g. make abi SOURCE=CrossSimpleModule"
20+
@exit 1
2121
endif

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A coordinator feature of the simple commit and two-phase commit will be provided
1414

1515
## Contract module development
1616

17-
A developer who develops contract using Cross Framework need to implement IContractModule, which is defined in [IContractModule.sol](./contracts/core/IContractModule.sol).
17+
A developer who develops contract using Cross Framework need to implement IContractModule, which is defined in [IContractModule.sol](./src/core/IContractModule.sol).
1818

1919
```
2020
// IContractModule defines the expected interface of a contract module on Cross Framework
@@ -32,7 +32,7 @@ interface IContractModule {
3232

3333
## How to deploy a contract module
3434

35-
[Here](./migrations/2_deploy_contracts.js) is an example of deploying with the module `CrossSimpleModule` that implements the simple commit.
35+
[Here](./script/DeployAll.s.sol) is an example of deploying with the module `CrossSimpleModule` that implements the simple commit.
3636

3737
## For Developers
3838

chains/docker-compose.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
version: "3.3"
22
services:
33
development:
4-
image: trufflesuite/ganache-cli:v6.12.2
4+
image: ghcr.io/foundry-rs/foundry:stable
5+
entrypoint: ["anvil"]
6+
command:
7+
[
8+
"--host","0.0.0.0",
9+
"--port","8545",
10+
"--chain-id","31337",
11+
"--accounts","10",
12+
"--mnemonic","math razor capable expose worth grape metal sunset metal sudden usage scheme",
13+
"--gas-limit","1000000000"
14+
]
515
ports:
6-
- 8545:8545
7-
- 8546:8546
8-
command: -l 1000000000 -p 8545 -m "math razor capable expose worth grape metal sunset metal sudden usage scheme"
16+
- "8545:8545"
17+
restart: unless-stopped
18+
healthcheck:
19+
test: ["CMD", "curl", "-s", "http://127.0.0.1:8545", "-H", "Content-Type: application/json", "-d", "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_blockNumber\",\"params\":[]}"]
20+
interval: 2s
21+
timeout: 1s
22+
retries: 30
923
geth:
1024
build: ./geth
1125
ports:

contracts/Migrations.sol

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)