Skip to content

Commit 4ba5eda

Browse files
authored
deployed to testnet and vercel (#7)
1 parent a6a5ab2 commit 4ba5eda

File tree

4 files changed

+49
-20
lines changed

4 files changed

+49
-20
lines changed

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
DEPLOYER_SK=
2-
ID_HUB_ADDR=
1+
DEPLOYER_SK="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
2+
ID_HUB_ADDR="0x68c931C9a534D37aa78094877F46fE46a49F1A51"
33
SELF_SCOPE=
4-
SELF_CONFIG_ID=
4+
SELF_CONFIG_ID="0xc52f992ebee4435b00b65d2c74b12435e96359d1ccf408041528414e6ea687bc"
55

66
NODE_ENV = "development"
77
# this env is read in packages/contract and packages/web

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,37 @@ DHK dao snapshot-self plugin prototype
66
- docs: https://docs.self.xyz/
77
- Self Developer Tools: https://tools.self.xyz/
88

9+
Snapshot
910
- Snapshot: https://docs.snapshot.box/developer-guides/validation-strategy
1011
- [DHK dao snapshot page](https://snapshot.box/#/s:dhkdao.eth)
1112

12-
- Get Celo Alfajores Testnet token at: [learnweb3](https://learnweb3.io/)
13+
Getting Celo Alfajores testnet token
14+
- Get Celo Alfajores testnet token at: [learnweb3](https://learnweb3.io/)
1315
- Get LINK testnet token: https://faucets.chain.link/celo-alfajores-testnet
1416
- Swap for Celo native tokens: https://app.mento.org/
1517

1618
## Deployment
1719

20+
- Before deploying the verification contract on Celo network, make sure to run DeploySelfVerification script in simulation mode, get the contract deployment address, and use the [Self Developer Tools](https://tools.self.xyz/) to generate the correct scope value and set it to **SELF_SCOPE** inside `.env` file.
21+
22+
- frontend: https://dhkdao-self.vercel.app
23+
1824
- SelfVerification:
25+
Celo Alfajores Testnet: [`0x0Ea37D3264b940C94D68DA1EB34C291D62Ba8Ab5`](https://celo-alfajores.blockscout.com/address/0x0Ea37D3264b940C94D68DA1EB34C291D62Ba8Ab5)
26+
27+
## Demo
28+
29+
- [demo video (web-side)](https://www.loom.com/share/9b7b2bc04d884c9ea24d934085a0ee79?sid=0473c41d-4c9c-48ff-92d7-895d2ef2623c)
30+
- [demo video (mobile-side)](https://www.dropbox.com/scl/fi/4ogz6l14iip4zl3rde3ak/dhkdao-self-demo.MP4?rlkey=t7tmer0w390ado2rg6gmtbn8d&dl=0)
31+
32+
## Verification Flow
33+
34+
The verification flow is as follow:
35+
36+
1. Showing the Self QR code. The QR Code is configured [here](https://github.com/dhkdao/self-prototype/blob/a6a5ab229c76188df8f22a93f9e2d694bb4eccfb/packages/web/src/components/VerificationComponent.tsx#L69-L97).
37+
38+
2. On-chain verification happens in [the smart contract](https://github.com/dhkdao/self-prototype/blob/main/packages/contracts/src/SelfVerification.sol), with the callback function implemented at [**customVerificationHook()**](https://github.com/dhkdao/self-prototype/blob/a6a5ab229c76188df8f22a93f9e2d694bb4eccfb/packages/contracts/src/SelfVerification.sol#L37-L52), emitting the **VerificationCompleted** event.
39+
40+
3. Front-end [listens to](https://github.com/dhkdao/self-prototype/blob/a6a5ab229c76188df8f22a93f9e2d694bb4eccfb/packages/web/src/components/VerificationComponent.tsx#L42-L53) VerificationCompleted event. Upon event emitted, it will call [backend `/api/verify-successful` route](https://github.com/dhkdao/self-prototype/blob/a6a5ab229c76188df8f22a93f9e2d694bb4eccfb/packages/web/src/components/VerificationComponent.tsx#L128-L143).
1941

20-
Celo Alfajores Testnet: [`0xED3C8a827cE54C4D74A6476d93A9352D91d4e88E`](https://celo-alfajores.blockscout.com/address/0xED3C8a827cE54C4D74A6476d93A9352D91d4e88E)
42+
4. The backend checks the user DHK token balance >= 1, and other logics (e.g. check for subname), and return a JSON corresponding if a user satisfy all the conditions.

packages/web/src/components/Web3Provider.tsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ import { WagmiProvider, createConfig, webSocket } from "wagmi";
55
import { celoAlfajores, foundry } from "wagmi/chains";
66
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
77
import { ConnectKitProvider, getDefaultConfig } from "connectkit";
8+
import { type Chain } from "viem";
89
import { appName } from "@/config";
910

1011
const chains =
1112
process.env.NODE_ENV === "development"
12-
? [foundry, celoAlfajores]
13-
: [celoAlfajores];
14-
const transports =
15-
process.env.NODE_ENV === "development"
16-
? {
17-
[foundry.id]: webSocket("http://localhost:8545"),
18-
[celoAlfajores.id]: webSocket(
19-
`https://celo-alfajores.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`,
20-
),
21-
}
22-
: {
23-
[celoAlfajores.id]: webSocket(
24-
`https://celo-alfajores.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`,
25-
),
26-
};
13+
? ([foundry, celoAlfajores] as const)
14+
: ([celoAlfajores] as const);
15+
16+
const transports: Record<number, ReturnType<typeof webSocket>> = {
17+
[foundry.id]: process.env.NODE_ENV === "development"
18+
? webSocket("http://localhost:8545")
19+
: undefined as unknown as ReturnType<typeof webSocket>,
20+
[celoAlfajores.id]: webSocket(
21+
`https://celo-alfajores.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_ID}`,
22+
),
23+
};
24+
// Remove undefined keys (for production)
25+
Object.keys(transports).forEach(
26+
(key) => transports[key as unknown as number] === undefined && delete transports[key as unknown as number]
27+
);
2728

2829
export const ckConfig = getDefaultConfig({
2930
// Your dApps chains

vercel.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://openapi.vercel.sh/vercel.json",
3+
"git": {
4+
"deploymentEnabled": false
5+
}
6+
}

0 commit comments

Comments
 (0)