Skip to content

Commit

Permalink
feat: add tests and scripts (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
yum0e committed Jul 18, 2023
1 parent ed6768a commit 5825929
Show file tree
Hide file tree
Showing 58 changed files with 5,535 additions and 8 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/forge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: [push]

name: Forge Tests

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install submodules
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
git submodule update --init --recursive
- name: Install dependencies
run: forge install

- name: Compile
run: forge build

- name: Run Forge tests
run: forge test -vvv
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/hydra-s3-zkps"]
path = lib/hydra-s3-zkps
url = https://github.com/sismo-core/hydra-s3-zkps
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
69 changes: 69 additions & 0 deletions .hardhat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<br />
<div align="center">
<img src="https://static.sismo.io/readme/top-main.png" alt="Logo" width="150" height="150" style="borderRadius: 20px">

<h3 align="center">
Sismo Connect Solidity
</h3>

<p align="center">
Made by <a href="https://docs.sismo.io/" target="_blank">Sismo</a>
</p>

<p align="center">
<a href="https://twitter.com/sismo_eth" target="_blank">
<img src="https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white"/>
</a>
<a href="https://discord.gg/sismo" target="_blank">
<img src="https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white"/>
</a>
<a href="https://builders.sismo.io" target="_blank">
<img src="https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white"/>
</a>
</p>
</div>


Sismo Connect Solidity is a Solidity library that allows you to verify the zk-proofs of your Sismo Connect Application onchain and simplify the use of the [sismo-connect-onchain-verifier](https://github.com/sismo-core/sismo-connect-onchain-verifier).

Here is the link to the full documentation of the library: [Sismo Connect Solidity Library](https://docs.sismo.io/build-with-sismo-connect/technical-documentation/solidity)

You can learn more on Sismo Connect [here](https://docs.sismo.io/discover-sismo-connect/empower-your-app).

### Prerequisites

- [Node.js](https://nodejs.org/en/download/) >= 18.15.0 (Latest LTS version)
- [Yarn](https://classic.yarnpkg.com/en/docs/install)

## Usage

### Installation

```bash
# install the package
yarn add @sismo-core/sismo-connect-solidity
```

### Import the library
In your solidity file:

```solidity
import {SismoConnect} from "@sismo-core/sismo-connect-solidity/contracts/libs/SismoLib.sol";
```

You will find here how to use the library: [Sismo Connect Solidity Library](https://docs.sismo.io/build-with-sismo-connect/technical-documentation/solidity)

## License

Distributed under the MIT License.

## Contribute

Please, feel free to open issues, PRs or simply provide feedback!

## Contact

Send us a message in [Telegram](https://builders.sismo.io/) or [Discord](https://discord.gg/sismo)

<br/>
<img src="https://static.sismo.io/readme/bottom-main.png" alt="bottom" width="100%" >
25 changes: 25 additions & 0 deletions .hardhat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@sismo-core/sismo-connect-solidity",
"description": "Sismo Connect Library",
"version": "0.0.19",
"scripts": {
"prepare": "mkdir -p contracts; cp -r ../src/* contracts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sismo-core/sismo-connect-onchain-verifier.git"
},
"keywords": [
"solidity",
"ethereum",
"smart",
"contracts"
],
"author": "Sismo <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/sismo-core/sismo-connect-onchain-verifier/issues"
},
"homepage": "https://github.com/sismo-core/sismo-connect-onchain-verifier#readme",
"main": "index.js"
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
</div>


Sismo Connect Solidity is a Solidity library that allows you to verify the zk-proofs of your Sismo Connect Application onchain and simplify the use of the [sismo-connect-onchain-verifier](https://github.com/sismo-core/sismo-connect-onchain-verifier).
Sismo Connect Solidity is a Solidity library that allows you to verify the zk-proofs of your Sismo Connect Application onchain.

Here is the link to the full documentation of the library: [Sismo Connect Solidity Library](https://docs.sismo.io/build-with-sismo-connect/technical-documentation/solidity)

You can learn more on Sismo Connect [here](https://docs.sismo.io/discover-sismo-connect/empower-your-app).
You can learn more on Sismo Connect [here](https://docs.sismo.io/sismo-docs/build-with-sismo-connect/getting-started).

### Prerequisites

Expand All @@ -48,7 +48,7 @@ foundryup
forge install sismo-core/sismo-connect-solidity --no-commit

# add the remapping in remappings.txt
echo $'sismo-connect-solidity/=lib/sismo-connect-packages/src/' >> remappings.txt
echo $'sismo-connect-solidity/=lib/sismo-connect-solidity/src/' >> remappings.txt
```

### Import the library
Expand All @@ -58,7 +58,7 @@ In your solidity file:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "sismo-connect-solidity/SismoLib.sol"; // import the library
import "sismo-connect-solidity/SismoConnectLib.sol"; // import the library
```

## License
Expand Down
18 changes: 18 additions & 0 deletions deployments/arbitrum-goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xD4339e6d873b584FFfeACceE4CcB8Bf31Cd96ebb",
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"claimRequestBuilder": "0xF03dA119efEc165DbDc15D593aB455810C7fEd74",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x9854860CBEa52E19Ca252D1948F04070eBC46b2C",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x8eAb4616d47F82C890fdb6eE311A4C0aE34ba7fb",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xb1327210BAF0E8793f3f4D671573ac1A45619edf"
}
18 changes: 18 additions & 0 deletions deployments/arbitrum-one.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"availableRootsRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"claimRequestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0xAa745f3833faCE895E0e7f99eD0A4989a470E150",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x40e208f4815Ce25b32BeEEC7415C6CA9424a898F",
"rootsOwner": "0x1BB9AD70F529e36B7Ffed0cfA44fA4cf0213Fa09",
"signatureBuilder": "0x1e7a99e06Ca2C1A63330eC2df8D4fC15EfDa4C55",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x80a914AaFB60519a58f531D80fd402ae88047896"
}
18 changes: 18 additions & 0 deletions deployments/gnosis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0x900F4aD11Ec071e7f93Bf4e0c8976aE2Af5D28E5",
"availableRootsRegistry": "0x9B0C9EF48DEc082904054cf9183878E1f4e04D79",
"claimRequestBuilder": "0x0c5a188E778a9A0736fCBf25aF6298E92182D676",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"hydraS3Verifier": "0x0F85c4Fe7644E85579e27A027D94d1Fb3A388710",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"rootsOwner": "0xEf809a50de35c762FBaCf1ae1F6B861CE42911D1",
"signatureBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xd1fbf35B45748B2F6998fb7B86eb6A3d73fe91ED"
}
18 changes: 18 additions & 0 deletions deployments/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0x94E772DBe3ce4BD32274a2053C444C802Bb836A5",
"availableRootsRegistry": "0x2E7f4aC6AC90faeC2D870D012A3BCDBcF792B25C",
"claimRequestBuilder": "0x900F4aD11Ec071e7f93Bf4e0c8976aE2Af5D28E5",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xb4463Dbcd773F7Ca37E63f12dce9852e59dC86C9",
"hydraS3Verifier": "0x89f40fd037e62eAec7511b0711f781AA57A3e96f",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"rootsOwner": "0x2a265b954B96d4940B94eb69E8Fc8E7346369D05",
"signatureBuilder": "0x0c5a188E778a9A0736fCBf25aF6298E92182D676",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x0568ecE836a0881cd305ad53046AB51467B0886a"
}
18 changes: 18 additions & 0 deletions deployments/optimism-goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xD4339e6d873b584FFfeACceE4CcB8Bf31Cd96ebb",
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"claimRequestBuilder": "0xF03dA119efEc165DbDc15D593aB455810C7fEd74",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0xe807B5153e3eD4767C3F4EB50b65Fab90c57596B",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
18 changes: 18 additions & 0 deletions deployments/optimism.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"availableRootsRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"claimRequestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x1C4Bd61F5b19750ffb7b0b2D97c77dcf68F49152",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x40e208f4815Ce25b32BeEEC7415C6CA9424a898F",
"rootsOwner": "0xf8640cE5532BCbc788489Bf5A786635ae585258B",
"signatureBuilder": "0x1e7a99e06Ca2C1A63330eC2df8D4fC15EfDa4C55",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xAE116c797ae424BF232DfFcdF8a3b741D9e6460c"
}
18 changes: 18 additions & 0 deletions deployments/polygon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0x900F4aD11Ec071e7f93Bf4e0c8976aE2Af5D28E5",
"availableRootsRegistry": "0x818c0f863C6B8E92c316924711bfEb2D903B4A77",
"claimRequestBuilder": "0x0c5a188E778a9A0736fCBf25aF6298E92182D676",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"hydraS3Verifier": "0x027AcA627F7D13572A54ac2d027A770ca3eF22c8",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"rootsOwner": "0xF0a0B692e1c764281c211948D03edEeF5Fb57111",
"signatureBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x1C4Bd61F5b19750ffb7b0b2D97c77dcf68F49152"
}
18 changes: 18 additions & 0 deletions deployments/scroll-testnet-goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xD4339e6d873b584FFfeACceE4CcB8Bf31Cd96ebb",
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"claimRequestBuilder": "0xF03dA119efEc165DbDc15D593aB455810C7fEd74",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
18 changes: 18 additions & 0 deletions deployments/testnet-goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xD4339e6d873b584FFfeACceE4CcB8Bf31Cd96ebb",
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"claimRequestBuilder": "0xF03dA119efEc165DbDc15D593aB455810C7fEd74",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x1F60E4023C84e7e5897722b04BEc3De7eEa78DEF",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0xa687922C4bf2eB22297FdF89156B49eD3727618b",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x2bF68E251A94c83dB3da30a5A997c73705DF1B8b"
}
18 changes: 18 additions & 0 deletions deployments/testnet-mumbai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xF392c4EAB659Ba22cF40F201996178929f3C9d65",
"availableRootsRegistry": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"claimRequestBuilder": "0xb1327210BAF0E8793f3f4D671573ac1A45619edf",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4",
"hydraS3Verifier": "0xBA63Ad5f5570B7Adc82319529eB0694B31f2422E",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0xc33d0496571513c676de73b13c7166e245CD4d5E",
"rootsOwner": "0xCA0583A6682607282963d3E2545Cd2e75697C2bb",
"signatureBuilder": "0x16Cb98567cE6f177C1855906230874AE8c5a8B7f",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xf219113C648dA1D9F0f12EB1898A6a22fEe86dF8"
}
18 changes: 18 additions & 0 deletions deployments/testnet-sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"authRequestBuilder": "0xD4339e6d873b584FFfeACceE4CcB8Bf31Cd96ebb",
"availableRootsRegistry": "0x32725B00400b799D41c852b6Fd94604e10cb487F",
"claimRequestBuilder": "0xF03dA119efEc165DbDc15D593aB455810C7fEd74",
"commitmentMapperEdDSAPubKey": {
"pubKeyX": 3602196582082511412345093208859330584743530098298494929484637038525722574265,
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x1C0c54EA7Bb55f655fb8Ff6D51557368bA8624E6",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
Loading

0 comments on commit 5825929

Please sign in to comment.