Skip to content

Commit 315c2de

Browse files
authored
Initial commit
0 parents  commit 315c2de

31 files changed

Lines changed: 11331 additions & 0 deletions

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
WORLD_ID_ROUTER=0x11cA3127182f7583EfC416a8771BD4d11Fae4334
2+
NEXT_PUBLIC_APP_ID=
3+
NEXT_PUBLIC_ACTION=
4+
NEXT_PUBLIC_WALLETCONNECT_ID=
5+
NEXT_PUBLIC_CONTRACT_ADDRESS=

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.github/workflows/relyance-sci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Relyance SCI Scan
2+
3+
on:
4+
schedule:
5+
- cron: "0 20 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
execute-relyance-sci:
10+
name: Relyance SCI Job
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Pull and run SCI binary
18+
run: |-
19+
docker pull gcr.io/relyance-ext/compliance_inspector:release && \
20+
docker run --rm -v `pwd`:/repo --env API_KEY='${{ secrets.DPP_SCI_KEY }}' gcr.io/relyance-ext/compliance_inspector:release

.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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts

.gitmodules

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

.prettierrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
printWidth: 120,
5+
tabWidth: 4,
6+
trailingComma: 'es5',
7+
useTabs: true,
8+
bracketSpacing: true,
9+
arrowParens: 'avoid',
10+
plugins: [require('prettier-plugin-sort-imports-desc')],
11+
}

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"juanblanco.solidity"
4+
]
5+
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"cSpell.words": [
3+
"connectkit",
4+
"consts",
5+
"predev",
6+
"Sepolia",
7+
"tanstack",
8+
"viem",
9+
"Wagmi",
10+
"WALLETCONNECT",
11+
"zustand"
12+
],
13+
}

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# World ID On-Chain Template
2+
3+
Template repository for a World ID On-Chain Integration.
4+
5+
## Local Development
6+
7+
### Prerequisites
8+
9+
Create a staging on-chain app in the [Worldcoin Developer Portal](https://developer.worldcoin.org).
10+
11+
Ensure you have installed [Foundry](https://book.getfoundry.sh/getting-started/installation), [NodeJS](https://nodejs.org/en/download), and [pnpm](https://pnpm.io/installation).
12+
13+
### Local Testnet Setup
14+
15+
Start a local node forked from Optimism Sepolia, replacing `$YOUR_API_KEY` with your Alchemy API key:
16+
17+
```bash
18+
# leave this running in the background
19+
anvil -f https://opt-sepolia.g.alchemy.com/v2/$YOUR_API_KEY
20+
```
21+
22+
In another shell, deploy the contract, replacing `$WORLD_ID_ROUTER` with the [World ID Router address](https://docs.worldcoin.org/reference/address-book) for your selected chain, `$NEXT_PUBLIC_APP_ID` with the app ID as configured in the [Worldcoin Developer Portal](https://developer.worldcoin.org), and `$NEXT_PUBLIC_ACTION` with the action ID as configured in the Worldcoin Developer Portal:
23+
24+
```bash
25+
cd contracts
26+
forge create --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 src/Contract.sol:Contract --constructor-args $WORLD_ID_ROUTER $NEXT_PUBLIC_APP_ID $NEXT_PUBLIC_ACTION
27+
```
28+
29+
Note the `Deployed to:` address from the output.
30+
31+
### Local Web Setup
32+
33+
In a new shell, install project dependencies:
34+
35+
```bash
36+
pnpm i
37+
```
38+
39+
Set up your environment variables in the `.env` file. You will need to set the following variables:
40+
- `NEXT_PUBLIC_APP_ID`: The app ID as configured in the [Worldcoin Developer Portal](https://developer.worldcoin.org).
41+
- `NEXT_PUBLIC_ACTION`: The action ID as configured in the Worldcoin Developer Portal.
42+
- `NEXT_PUBLIC_WALLETCONNECT_ID`: Your WalletConnect ID.
43+
- `NEXT_PUBLIC_CONTRACT_ADDRESS`: The address of the contract deployed in the previous step.
44+
45+
Start the development server:
46+
47+
```bash
48+
pnpm dev
49+
```
50+
51+
The Contract ABI will be automatically re-generated and saved to `src/abi/ContractAbi.json` on each run of `pnpm dev`.
52+
53+
### Iterating
54+
55+
After making changes to the contract, you should:
56+
- re-run the `forge create` command from above
57+
- replace the `NEXT_PUBLIC_CONTRACT_ADDRESS` environment variable with the new contract address
58+
- if your contract ABI has changed, restart the local web server
59+
60+
### Testing
61+
62+
You'll need to import the private keys on the local testnet into your wallet used for local development. The default development seed phrase is `test test test test test test test test test test test junk`.
63+
64+
> [!CAUTION]
65+
> This is only for local development. Do not use this seed phrase on mainnet or any public testnet.
66+
67+
When connecting your wallet to the local development environment, you will be prompted to add the network to your wallet.
68+
69+
Use the [Worldcoin Simulator](https://simulator.worldcoin.org) in place of World App to scan the IDKit QR codes and generate the zero-knowledge proofs.

0 commit comments

Comments
 (0)