Skip to content

Commit

Permalink
feat: clean onchain boilerplates (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
yum0e authored Jul 18, 2023
1 parent 3532232 commit db5df13
Show file tree
Hide file tree
Showing 19 changed files with 599 additions and 645 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/sismo-connect-packages"]
path = lib/sismo-connect-packages
url = https://github.com/sismo-core/sismo-connect-packages
[submodule "lib/sismo-connect-solidity"]
path = lib/sismo-connect-solidity
url = https://github.com/sismo-core/sismo-connect-solidity
232 changes: 92 additions & 140 deletions abi/Airdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,116 +11,11 @@
"internalType": "string",
"name": "symbol",
"type": "string"
},
{
"internalType": "bytes16",
"name": "appId",
"type": "bytes16"
},
{
"internalType": "bool",
"name": "isImpersonationMode",
"type": "bool"
},
{
"components": [
{
"internalType": "enum AuthType",
"name": "authType",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "userId",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isAnon",
"type": "bool"
},
{
"internalType": "bool",
"name": "isOptional",
"type": "bool"
},
{
"internalType": "bool",
"name": "isSelectableByUser",
"type": "bool"
},
{
"internalType": "bytes",
"name": "extraData",
"type": "bytes"
}
],
"internalType": "struct AuthRequest[]",
"name": "authRequests",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum ClaimType",
"name": "claimType",
"type": "uint8"
},
{
"internalType": "bytes16",
"name": "groupId",
"type": "bytes16"
},
{
"internalType": "bytes16",
"name": "groupTimestamp",
"type": "bytes16"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isOptional",
"type": "bool"
},
{
"internalType": "bool",
"name": "isSelectableByUser",
"type": "bool"
},
{
"internalType": "bytes",
"name": "extraData",
"type": "bytes"
}
],
"internalType": "struct ClaimRequest[]",
"name": "claimRequests",
"type": "tuple[]"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "AlreadyClaimed",
"type": "error"
},
{
"inputs": [
{
"internalType": "enum AuthType",
"name": "authType",
"type": "uint8"
}
],
"name": "AuthTypeNotFoundInVerifiedResult",
"type": "error"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -399,32 +294,18 @@
"internalType": "bytes",
"name": "response",
"type": "bytes"
},
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "claimWithSismo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "claimed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "config",
Expand Down Expand Up @@ -496,7 +377,7 @@
},
{
"inputs": [],
"name": "getVerifiedAuths",
"name": "getSismoConnectRequest",
"outputs": [
{
"components": [
Expand All @@ -505,28 +386,75 @@
"name": "authType",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "userId",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isAnon",
"type": "bool"
},
{
"internalType": "uint256",
"name": "userId",
"type": "uint256"
"internalType": "bool",
"name": "isOptional",
"type": "bool"
},
{
"internalType": "bool",
"name": "isSelectableByUser",
"type": "bool"
},
{
"internalType": "bytes",
"name": "extraData",
"type": "bytes"
}
],
"internalType": "struct AuthRequest[]",
"name": "",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum ClaimType",
"name": "claimType",
"type": "uint8"
},
{
"internalType": "bytes16",
"name": "groupId",
"type": "bytes16"
},
{
"internalType": "bytes16",
"name": "groupTimestamp",
"type": "bytes16"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isOptional",
"type": "bool"
},
{
"internalType": "bool",
"name": "isSelectableByUser",
"type": "bool"
},
{
"internalType": "bytes",
"name": "proofData",
"name": "extraData",
"type": "bytes"
}
],
"internalType": "struct VerifiedAuth[]",
"internalType": "struct ClaimRequest[]",
"name": "",
"type": "tuple[]"
}
Expand All @@ -536,8 +464,40 @@
},
{
"inputs": [],
"name": "getVerifiedClaims",
"name": "getSismoConnectVerifiedResult",
"outputs": [
{
"components": [
{
"internalType": "enum AuthType",
"name": "authType",
"type": "uint8"
},
{
"internalType": "bool",
"name": "isAnon",
"type": "bool"
},
{
"internalType": "uint256",
"name": "userId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "extraData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "proofData",
"type": "bytes"
}
],
"internalType": "struct VerifiedAuth[]",
"name": "",
"type": "tuple[]"
},
{
"components": [
{
Expand Down Expand Up @@ -579,15 +539,7 @@
"internalType": "struct VerifiedClaim[]",
"name": "",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getVerifiedSignedMessage",
"outputs": [
},
{
"internalType": "bytes",
"name": "",
Expand Down
3 changes: 1 addition & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS='--max-http-header-size=24576' next dev -p 3000 & nodemon --watch ./src/app/sismo-connect-config.ts --watch ../src/Airdrop.sol --exec 'npm run config-to-json && npm run deploy-airdrop && sleep 3 && ./script/log.sh'",
"dev": "NODE_OPTIONS='--max-http-header-size=24576' next dev -p 3000 & nodemon --watch ../src/Airdrop.sol --exec 'npm run deploy-airdrop && sleep 3 && ./script/log.sh'",
"build": "next build",
"start": "NODE_OPTIONS='--max-http-header-size=24576' next start",
"lint": "next lint",
"config-to-json": "npx tsx ./script/sismo-config-to-json.ts > ../sismo-connect-config.json",
"deploy-airdrop": "forge script DeployAirdrop --rpc-url http://localhost:8545 -vv --mnemonics 'test test test test test test test test test test test junk' --sender '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' --broadcast && ./script/generate-abi-from-front.sh"
},
"browser": {
Expand Down
19 changes: 0 additions & 19 deletions front/script/sismo-config-to-json.ts

This file was deleted.

2 changes: 1 addition & 1 deletion front/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Header: React.FC = () => {
the frontend <br />
3. The frontend forwards the response to ERC20 smart contract via claimWithSismo function{" "}
<br />
4. The smart contract the proofs contained in the response, mints ERC20 tokens and stores
4. The smart contract verifies the proofs contained in the response, mints ERC20 tokens and stores
verified claims and auths <br />
5. The frontend reads the verified claims and auths from the contract and displays them
</p>
Expand Down
Loading

0 comments on commit db5df13

Please sign in to comment.