Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P 867 #2

Merged
merged 27 commits into from
Jun 26, 2024
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
1 change: 1 addition & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PARACHAIN_ENDPOINT=wss://localhost:9944
113 changes: 56 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,60 @@
name: General CI

on:
push:
branches:
- dev
paths-ignore:
- "**/README.md"
pull_request:
branches:
- dev
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- dev
paths-ignore:
- "**/README.md"
pull_request:
branches:
- dev
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
set-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: 18

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install deps
run: |
npm install

- name: Fmt check
run: |
npm run fmt-check

compile:
runs-on: ubuntu-latest
needs:
- fmt
steps:
- uses: actions/checkout@v4

- name: Compile solidity
run: |
npm run compile

hardhat-test:
runs-on: ubuntu-latest
needs:
- compile
steps:
- uses: actions/checkout@v4

- name: Run hardhat test
run: |
npm run test:all
set-env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: 18

fmt:
runs-on: ubuntu-latest
needs:
- set-env
steps:
- uses: actions/checkout@v4

- name: Install deps
run: |
npm install

- name: Fmt check
run: |
npm run fmt-check

compile-tests:
runs-on: ubuntu-latest
needs:
- fmt
steps:
- uses: actions/checkout@v4

- name: Install deps
run: |
npm install

- name: Compile solidity
run: |
npm run compile

- name: Run hardhat test
run: |
npm run test:all
26 changes: 13 additions & 13 deletions .github/workflows/delete-branch-after-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Delete branch after PR merge

on:
pull_request_target:
types:
- closed
pull_request_target:
types:
- closed

jobs:
delete_branch_optionally:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
delete_branch_optionally:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: delete_branch
run: |
git push origin --delete "${{ github.head_ref }}"
echo "remote branch ${{ github.head_ref }} deleted"
- name: delete_branch
run: |
git push origin --delete "${{ github.head_ref }}"
echo "remote branch ${{ github.head_ref }} deleted"
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
artifacts
cache
node_modules
.env
.idea
typechain-types
coverage
22 changes: 22 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"plugins": ["prettier-plugin-solidity"],
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": false,
"useTabs": true,
"printWidth": 80,
"overrides": [
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"printWidth": 80,
"tabWidth": 4,
"useTabs": true,
"singleQuote": false,
"bracketSpacing": true
}
}
]
}
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
![Logo](https://avatars.githubusercontent.com/u/51339301?s=200&v=4)

## Litentry Dynamic Assertion Contracts

This repo is the contracts part separated from the [litentry-parachain](https://github.com/litentry/litentry-parachain).

## System Requirements

- Node.js
- Typescript
- [Hardhat](https://hardhat.org/hardhat-runner/docs/getting-started#overview)
- Solidity

## Configuration

- [Solidity versions](https://hardhat.org/hardhat-runner/docs/advanced/multiple-solidity-versions)
- [Configuration Variables](https://hardhat.org/hardhat-runner/docs/config#configuration)

## Getting started

1. Install Node V18

2. Clone this repo

3. Switch to the right Node.js version using NVM.

```typescript
# From the repo's root
nvm use
```

4. Install dependencies with `npm`

```typescript
# From the repo's root
npm install
```

5. Compile contracts

```typescript
# From the repo's root
npm run compile or npx hardhat compile
```

[Compiled directory structure](https://hardhat.org/hardhat-runner/docs/advanced/artifacts#directory-structure)

6. Run ts-tests

```typescript
# From the repo's root
npm run test:all or npx hardhat test
```

[More tesing contracts details](https://hardhat.org/hardhat-runner/docs/guides/test-contracts)
40 changes: 40 additions & 0 deletions contracts/DynamicAssertion.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2020-2024 Trust Computing GmbH.
// This file is part of Litentry.
//
// Litentry is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Litentry is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.

// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity ^0.8.8;

import "./libraries/Identities.sol";

abstract contract DynamicAssertion {
string schema_url;

function execute(
Identity[] memory identities,
string[] memory secrets,
bytes memory params
)
public
virtual
returns (
string memory,
string memory,
string[] memory,
string memory,
bool
);
}
1 change: 1 addition & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compiled with solc 0.8.11
Loading
Loading