Skip to content

Commit c9f99a4

Browse files
authored
Webb-Solidity package structure (#65)
This PR changes the project structure to separate packages: - contracts: types of the latest solidity contracts - fixed-bridge: Wrapper-classes for anchors, bridges, etc. related to fixed-bridge. - tokens: Wrapper-classes for token functionality - utils: Common utilities e.g. toFixedHex and others. - vbridge: UNIMPLEMENTED, wrapper-classes for anchors, bridges, etc. related to variable bridges. This PR brings in a dependency on lerna for building and publishing the packages. This PR updates the root-directory package.json to include: - yarn build:packages - needs to be run before tests. - yarn compile - should be run instead of npx hardhat compile as it will run a script to update the src files in the contracts directory of the latest typechain output.
1 parent c913875 commit c9f99a4

File tree

154 files changed

+46092
-1143
lines changed

Some content is hidden

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

154 files changed

+46092
-1143
lines changed

.github/workflows/node.js.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ jobs:
2929
- run: git submodule update --init --recursive
3030
- run: yarn install --production=false
3131
- run: yarn compile
32+
- run: yarn build:packages
3233
- run: yarn test

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ node_modules
44
build/
55
.env
66

7+
#Packages
8+
packages/*/node_modules
9+
packages/*/lib
10+
packages/*/tsconfig.tsbuildinfo
11+
712
#Hardhat files
813
cache
914
artifacts
1015
/typechain
16+
/typechain-types
1117
/src
1218

1319
dist

lerna.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"packages": [
3+
"packages/*",
4+
"examples/*"
5+
],
6+
"version": "independent",
7+
"useWorkspaces": true,
8+
"npmClient": "yarn"
9+
}

lib/fixed-bridge/index.ts

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

lib/index.ts

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

package.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
{
2-
"name": "webb-solidity",
3-
"version": "0.1.7",
4-
"main": "index.js",
5-
"repository": "https://github.com/webb-tools/protocol-solidity.git",
6-
"author": "Webb Technologies",
2+
"name": "protocol-solidity",
3+
"repository": "git://github.com/webb-tools/protocol-solidity.git",
4+
"author": "Webb Developers <[email protected]>",
75
"license": "GPL-3.0-or-later",
6+
"private": true,
7+
"workspaces": [
8+
"packages/*"
9+
],
810
"scripts": {
9-
"compile": "npx hardhat compile",
11+
"compile": "npx hardhat compile && sh ./scripts/bash/copyTypechain.sh && yarn build:packages",
1012
"build": "yarn compile && yarn build:circuits && yarn build:ptau",
1113
"build:circuits": "./scripts/bash/build_circuits.sh",
14+
"build:packages": "lerna run build",
1215
"build:ptau": "./scripts/bash/generate_phase1_ptau.sh",
13-
"prepublishOnly": "tsc && ./scripts/bash/npm/prepublish.sh",
14-
"run:deploy-webb": "ts-node ./scripts/evm/webbSystemDeployment.ts",
15-
"run:inspect-webb": "ts-node ./scripts/evm/inspectWebbInstance.ts",
16-
"run:link-webbs": "ts-node ./scripts/evm/linkAnchors.ts",
16+
"clean": "rm -rf artifacts typechain && yarn clean:packages",
17+
"clean:packages": "lerna run clean",
18+
"publish:packages": "lerna run build && lerna publish",
1719
"setup:bridge2": "./scripts/bash/groth16/bridge/phase2_poseidon_bridge2.sh",
1820
"setup:bridge3": "./scripts/bash/groth16/bridge/phase2_poseidon_bridge3.sh",
1921
"setup:bridge4": "./scripts/bash/groth16/bridge/phase2_poseidon_bridge4.sh",
@@ -34,12 +36,12 @@
3436
"@types/mocha": "^9.0.0",
3537
"chai": "^4.3.4",
3638
"ethereum-waffle": "^3.4.0",
37-
"ethers": "^5.3.1",
39+
"ethers": "5.5.1",
3840
"ffiasm": "^0.1.1",
3941
"ffjavascript": "^0.2.38",
4042
"ganache-cli": "^6.12.2",
41-
"hardhat": "^2.4.1",
42-
"snarkjs": "^0.4.10",
43+
"hardhat": "^2.6.8",
44+
"lerna": "~4.0.0",
4345
"solparse": "^2.2.8",
4446
"truffle-assertions": "^0.9.2",
4547
"web3": "^1.3.6",
@@ -66,8 +68,8 @@
6668
"maci-domainobjs": "^0.9.1",
6769
"prettier": "^2.3.2",
6870
"prettier-plugin-solidity": "^1.0.0-beta.18",
71+
"snarkjs": "^0.4.10",
6972
"ts-node": "^10.1.0",
7073
"typechain": "^5.1.2"
71-
},
72-
"files": ["src/**/*"]
74+
}
7375
}

0 commit comments

Comments
 (0)