-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from dl-solarity/dev
set up docusaurus, doc structure
- Loading branch information
Showing
125 changed files
with
22,840 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve("@docusaurus/core/lib/babel/preset")], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Overview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Overview |
109 changes: 109 additions & 0 deletions
109
docs/reference/contracts/access-control/MerkleWhitelisted.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Oops, something went wrong.