Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ env:
ID_HUB_ADDR: "0x68c931C9a534D37aa78094877F46fE46a49F1A51"
SELF_SCOPE: "8881796546691635711476357071947099946348416895373566002268674093031321389112"
SELF_CONFIG_ID: "0xc52f992ebee4435b00b65d2c74b12435e96359d1ccf408041528414e6ea687bc"
NEXT_PUBLIC_SELF_APP_NAME: "DHK dao Identity Verification"
NEXT_PUBLIC_SELF_SCOPE: "8881796546691635711476357071947099946348416895373566002268674093031321389112"
NEXT_PUBLIC_SELF_ENDPOINT: "https://burro-concise-regularly.ngrok-free.app/api/verify"

jobs:
ci-check:
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"scripts": {
"build": "forge build",
"dev": "pnpm build && conc -n 'node,deploy' -c auto 'pnpm node' 'pnpm deploy:dev'",
"node": "anvil -f https://alfajores-forno.celo-testnet.org/",
"node": "anvil",
"test": "forge test",
"deploy:dev": "wait-on -t 10s tcp:localhost:8545 && forge script script/DeploySelfVerification.s.sol --rpc-url http://localhost:8545 --broadcast",
"listenEvents": "tsx lib/listenEvents.ts"
"script:listenEvents": "tsx script/listenEvents.ts",
"script:testVerificationCompletedEvent": "forge script script/TestVerificationCompletedEvent.sol --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast --sig 'run(string,string,string)'"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/script/DeploySelfVerification.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
pragma solidity ^0.8.28;

import {Script, console} from "forge-std/Script.sol";
import {SelfVerification} from "../src/SelfVerification.sol";
Expand Down
28 changes: 28 additions & 0 deletions packages/contracts/script/TestVerificationCompletedEvent.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;

import {Script} from "forge-std/Script.sol";
import {SelfVerification} from "../src/SelfVerification.sol";

contract TestVerificationCompletedEvent is Script {
SelfVerification public sv;

function run(
string memory userId,
string memory nationality,
string memory userData
) public {
address contractAddr = vm.envAddress("NEXT_PUBLIC_VERIFICATION_DEPLOYED_ADDR");
sv = SelfVerification(contractAddr);

vm.startBroadcast();

sv.testVerificationCompletedEvent(
vm.parseAddress(userId),
nationality,
bytes(userData)
);

vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ console.log(`Listening to on-chain events\nrpc-url: ${RPC_URL}, address: ${contr
const unwatch = publicClient.watchEvent({
address: contractAddress,
events: parseAbi([
'event VerificationCompleted(address indexed sender, string indexed nationality, bytes userData)'
'event VerificationCompleted(address indexed sender, string indexed nationality, uint32 times, bytes userData)'
]),
onLogs: (logs) => console.log(logs)
onLogs: (logs) => {
for (const [i, log] of logs.entries()) {
console.log(`-- event ${i} --`);
console.log(`name: ${log.eventName}`);
console.log(`args:`, log.args);
}
}
});
16 changes: 16 additions & 0 deletions packages/contracts/src/ERC20Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {ERC20} from "solady/tokens/ERC20.sol";

/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
contract ERC20Token is ERC20 {
function name() public pure override returns (string memory) {
return "ERC20 Token";
}
function symbol() public pure override returns (string memory) {
return "TOKEN";
}
}
9 changes: 9 additions & 0 deletions packages/contracts/src/SelfVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ contract SelfVerification is SelfVerificationRoot, Ownable {
// - etc.
}

function testVerificationCompletedEvent(
address userId,
string memory nationality,
bytes memory userData
) external onlyOwner {
verifiedHumans[userId] += 1;
emit VerificationCompleted(userId, nationality, verifiedHumans[userId], userData);
}

function getConfigId(
bytes32 /* _destinationChainId */,
bytes32 /* _userIdentifier */,
Expand Down
4 changes: 2 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"build": "next build",
"start": "next start",
"lint": "tsc && prettier -c . && next lint",
"ngrok": "ngrok http --url=burro-concise-regularly.ngrok-free.app 3000",
"tunnel": "concurrently -n 'next,ngrok' -c auto 'pnpm dev' 'pnpm ngrok'",
"prettier:fix": "prettier -w ."
},
"dependencies": {
Expand All @@ -17,6 +15,7 @@
"@selfxyz/core": "^1.0.8",
"@selfxyz/qrcode": "^1.0.11",
"@tanstack/react-query": "^5.85.5",
"abitype": "^1.0.9",
"clsx": "^2.1.1",
"connectkit": "^1.9.1",
"geist": "^1.4.2",
Expand All @@ -33,6 +32,7 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"concurrently": "catalog:",
"dotenv": "catalog:",
"eslint": "^8",
"eslint-config-next": "13.2.4",
"pino-pretty": "^13.1.1",
Expand Down
Loading