Skip to content

Commit

Permalink
Merge pull request #3 from dl-solarity/dev
Browse files Browse the repository at this point in the history
set up docusaurus, doc structure
  • Loading branch information
Arvolear authored Dec 29, 2023
2 parents 1c0b968 + 958550a commit 22ae2c6
Show file tree
Hide file tree
Showing 125 changed files with 22,840 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- 'dev'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
# stage-deploy:
# name: Deploy on stage
# needs: converge
# runs-on: ubuntu-latest
# steps:
# - name: ConfigCreate
# run: |
# mkdir ~/.kube/
# echo "${{ secrets.KUBECONFIG }}" > config
# mv config ~/.kube/
# ls ~/.kube/
# kubectl set image deployment/ -n stage
49 changes: 49 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_REF_NAME
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME --dev
# prod-deploy:
# name: Deploy on prod
# needs: converge
# runs-on: ubuntu-latest
# steps:
# - name: Run echo
# run: |
# echo "Tag was created - deploying on prod"
# echo tag = $GITHUB_REF_NAME
# - name: ConfigCreate
# run: |
# mkdir ~/.kube/
# echo "${{ secrets.KUBECONFIG }}" > config
# mv config ~/.kube/
# ls ~/.kube/
# kubectl set image deployment/ -n prod
28 changes: 28 additions & 0 deletions .github/workflows/update-doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update Docusaurus

on:
repository_dispatch:
types:
- update-docusaurus

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update Docusaurus Docs
run: |
git clone https://github.com/dl-solarity/solidity-lib.git newdocs
rm -rf docs/reference/contracts/*/
cp -r newdocs/docs/* docs/reference/contracts/
- name: Commit and Push Changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add docs
git commit -m "Update documentation"
git push origin master
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.local
stats.html

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint-fix && git add -u
18 changes: 18 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"overrides": [
{
"files": "*.js",
"options": {
"printWidth": 120,
"tabWidth": 2
}
},
{
"files": "*.ts",
"options": {
"printWidth": 120,
"tabWidth": 2
}
}
]
}
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
1 change: 1 addition & 0 deletions docs/getting-started/Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Overview
1 change: 1 addition & 0 deletions docs/reference/contracts/Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Overview
109 changes: 109 additions & 0 deletions docs/reference/contracts/access-control/MerkleWhitelisted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# MerkleWhitelisted

## Abstract Contract Description


License: MIT

##

```solidity
abstract contract MerkleWhitelisted
```

The Whitelist Access Control module

This is a simple abstract contract that implements whitelisting logic.

The contract is based on a Merkle tree, which allows for the huge whitelists to be cheaply validated courtesy of
O(log(n)) tree complexity. The whitelist itself is stored in the tree leaves and only the root of the tree is saved on-chain.

To validate the whitelist belonging, the tree leaf (the whitelist element) has to be computed and passed to the
"root-construction" function together with the corresponding tree branches. The function will then check the
roots equality. If the roots match, the element belongs to the whitelist.

Note: the branch nodes are sorted numerically.
## Modifiers info

### onlyWhitelisted

```solidity
modifier onlyWhitelisted(bytes memory data_, bytes32[] calldata merkleProof_)
```


### onlyWhitelistedUser

```solidity
modifier onlyWhitelistedUser(address user_, bytes32[] calldata merkleProof_)
```


## Functions info

### isWhitelisted (0x7ea25896)

```solidity
function isWhitelisted(
bytes32 leaf_,
bytes32[] calldata merkleProof_
) public view returns (bool)
```

The function to check if the leaf belongs to the Merkle tree


Parameters:

| Name | Type | Description |
| :----------- | :-------- | :---------------------------------------------- |
| leaf_ | bytes32 | the leaf to be checked |
| merkleProof_ | bytes32[] | the path from the leaf to the Merkle tree root |


Return values:

| Name | Type | Description |
| :--- | :--- | :----------------------------------------------------------- |
| [0] | bool | true if the leaf belongs to the Merkle tree, false otherwise |

### isWhitelistedUser (0xa188491c)

```solidity
function isWhitelistedUser(
address user_,
bytes32[] calldata merkleProof_
) public view returns (bool)
```

The function to check if the user belongs to the Merkle tree


Parameters:

| Name | Type | Description |
| :----------- | :-------- | :---------------------------------------------- |
| user_ | address | the user to be checked |
| merkleProof_ | bytes32[] | the path from the user to the Merkle tree root |


Return values:

| Name | Type | Description |
| :--- | :--- | :----------------------------------------------------------- |
| [0] | bool | true if the user belongs to the Merkle tree, false otherwise |

### getMerkleRoot (0x49590657)

```solidity
function getMerkleRoot() public view returns (bytes32)
```

The function to get the current Merkle root


Return values:

| Name | Type | Description |
| :--- | :------ | :----------------------------------------------------------- |
| [0] | bytes32 | the current Merkle root or zero bytes if it has not been set |
Loading

0 comments on commit 22ae2c6

Please sign in to comment.