Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Refactor docs, makefile, scripts (#40)
Browse files Browse the repository at this point in the history
* update npm packages

* fix --legacy-peer-deps

* update docs scripts

* fix almost all whitespace problems

* add markdownlint-cli package & settings     Close #31.

* finish tweaking handlebars template

* docs generated

* remove custody mention

* restore solhint & solhint-plugin-prettier
Closes #32.

* fea: add extenders to md file

* add structs & enums to docs template

* temporarily remove helpers.ts

* add readmes, vault and clearing extenders

* add architecture and public readme

* add helpers.js to eslintignore

* fix type error after renaming

* add docs to prettierignore, add prettier check

* fix typos

* fea: log gas fees

* basic estimation & logging

* estimate gas on failings

* add environment variables

* mark packages stable versions

* tweak hardhat settings

* fix version variable unaccesability

* bring back solhint

* working logging on vault, clearing and vesting

* extract deploy clearing and vault

* use requireEnv method to get env variables

* add outDir env to export accounts

* deployments data

* fix docs script

* add blockscan links to addresses
Closes #38.

* remove environment

* remove wrong deployment tx info from deployments

* implement go-bindings generation

* update docs generation

* remove unused PLATFORM variable

* add docs about solc-select, scripts

* add yellow network test deployment

* minor changes to makefile

* Add docs on fetching participants from Registry
Closes #41.

* clarify 'locally' installed

* fix incorrect name of YellowClearing in drawio

* run lint:fix

Co-authored-by: nksazonov <nsazonov@openware.com>
  • Loading branch information
nksazonov and nksazonov authored Nov 14, 2022
1 parent 4233505 commit ce62de0
Show file tree
Hide file tree
Showing 106 changed files with 14,449 additions and 3,840 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ POLYGON_URL=https://polygon-mainnet.g.alchemy.com/v2/<YOUR ALCHEMY KEY>
MUMBAI_URL=https://polygon-mumbai.g.alchemy.com/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
POLYGONSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ cache
coverage
node_modules
typechain

/docs/api/templates/helpers.js
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
node_modules/
.env
/bindings/
coverage/
coverage.json
deployments/localhost
typechain/

# Misc
Expand All @@ -12,7 +14,6 @@ typechain/
cache/
/artifacts/
/.openzeppelin/unknown-*.json
/hardhat-deployments/

# Output of kaidump command
kaigara-data.yaml
4 changes: 4 additions & 0 deletions .markdownlint.autodocs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"no-duplicate-heading": false,
"no-multiple-blanks": false
}
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/artifacts/
/cache/
/coverage/
coverage.json
/docs/api
node_modules/
typechain/
package-lock.json
20 changes: 20 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["off"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["off"],
"no-empty-blocks": "off",
"not-rely-on-time": "off",
"quotes": ["error", "single"],
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"reason-string": ["warn", { "maxLength": 64 }]
}
}
4 changes: 4 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# directories

**/artifacts
**/node_modules
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"recommendations": [
"streetsidesoftware.code-spell-checker",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"nomicfoundation.hardhat-solidity",
"wayou.vscode-todo-highlight"
"streetsidesoftware.code-spell-checker",
"wayou.vscode-todo-highlight",
"davidanson.vscode-markdownlint"
],

"unwantedRecommendations": []
Expand Down
16 changes: 11 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
// Diff editor
"diffEditor.ignoreTrimWhitespace": false,

// Spell checker
"cSpell.enableFiletypes": ["javascript", "typescript", "solidity", "json", "markdown"],
"cSpell.includeRegExpList": ["CStyleComment"],
"cSpell.userWords": ["delegatecall", "keccak", "proxied", "reentrancy", "solhint", "struct"],
"cSpell.words": ["Structs"],

// Todo highlight
"todohighlight.isCaseSensitive": false,
"todohighlight.keywords": [
Expand All @@ -72,9 +78,9 @@
}
],

// Spell checker
"cSpell.enableFiletypes": ["javascript", "typescript", "solidity", "json", "markdown"],
"cSpell.includeRegExpList": ["CStyleComment"],
"cSpell.userWords": ["delegatecall", "keccak", "proxied", "reentrancy", "solhint", "struct"],
"cSpell.words": ["Structs"]
// markdownlint
"markdownlint.config": {
"no-duplicate-heading": false,
"no-multiple-blanks": false
}
}
67 changes: 49 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,55 @@
.PHONY=custody
.PHONY=smart-contracts

ABIGEN_VERSION=1.10.11-7231b3ef
ABIGEN_FILE=geth-alltools-linux-amd64-$(ABIGEN_VERSION)
ABIGEN_URL=https://gethstore.blob.core.windows.net/builds/$(ABIGEN_FILE).tar.gz
ABIGEN_VERSION = 1.10.26-e5eb32ac
SOLC_VERSION = 0.8.16

fetch-abigen:
mkdir -p cache
curl -L https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-$(ABIGEN_VERSION).tar.gz -o cache/geth-alltools.tar.gz
tar zxvf cache/geth-alltools.tar.gz --directory cache --strip-components=1
chmod +x cache/abigen
OUT_DIR = ./bindings/

abigen:
./cache/abigen --abi abi/contracts/custody/IVault.sol/IVault.json --pkg vault --type IVault --out IVault.go
./cache/abigen --abi abi/contracts/nitro-ptorocol/NitroAdjudicator.sol/NitroAdjudicator.json --pkg nitro --type NitroAdjudicator --out NitroAdjudicator.go
CACHE_DIR = ./cache

compile:
npm i
npx hardhat compile
SOLC_BIN = ${CACHE_DIR}/solc
ABIGEN_BIN = ${CACHE_DIR}/abigen

custody: compile fetch-abigen abigen
install-solc-lin:
mkdir -p ${CACHE_DIR}
curl -L https://github.com/ethereum/solidity/releases/download/v${SOLC_VERSION}/solc-static-linux -o ${SOLC_BIN}
chmod +x ${SOLC_BIN}

test:
npx hardhat test
install-solc-mac:
mkdir -p ${CACHE_DIR}
curl -L https://github.com/ethereum/solidity/releases/download/v${SOLC_VERSION}/solc-macos -o ${SOLC_BIN}
chmod +x ${SOLC_BIN}

install-abigen-lin:
mkdir -p ${CACHE_DIR}
curl -L https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-$(ABIGEN_VERSION).tar.gz -o ${CACHE_DIR}/geth-alltools.tar.gz
tar zxvf ${CACHE_DIR}/geth-alltools.tar.gz --directory ${CACHE_DIR} --strip-components=1 geth-alltools-linux-amd64-$(ABIGEN_VERSION)/abigen
rm -r ${CACHE_DIR}/geth-alltools.tar.gz
chmod +x ${ABIGEN_BIN}

install-abigen-mac:
mkdir -p ${CACHE_DIR}
curl -L https://gethstore.blob.core.windows.net/builds/geth-alltools-darwin-amd64-$(ABIGEN_VERSION).tar.gz -o ${CACHE_DIR}/geth-alltools.tar.gz
tar zxvf ${CACHE_DIR}/geth-alltools.tar.gz --directory ${CACHE_DIR} --strip-components=1 geth-alltools-darwin-amd64-$(ABIGEN_VERSION)/abigen
rm -r ${CACHE_DIR}/geth-alltools.tar.gz
chmod +x ${ABIGEN_BIN}

solc-all:
${SOLC_BIN} --combined-json abi,bin --base-path . --include-path ./node_modules -o ${CACHE_DIR}/solcoutput/YellowClearingV1 contracts/clearing/YellowClearingV1.sol --overwrite
${SOLC_BIN} --combined-json abi,bin --base-path . --include-path ./node_modules -o ${CACHE_DIR}/solcoutput/VaultImplV1 contracts/vault/VaultImplV1.sol --overwrite

abigen-all:
mkdir -p ${OUT_DIR}
${ABIGEN_BIN} --combined-json ${CACHE_DIR}/solcoutput/YellowClearingV1/combined.json --pkg YellowClearing --type Contract --out ${OUT_DIR}YellowClearing.go
${ABIGEN_BIN} --combined-json ${CACHE_DIR}/solcoutput/VaultImplV1/combined.json --pkg Vault --type Contract --out ${OUT_DIR}Vault.go

# require changed `SOLC_BIN` and `ABIGEN_BIN`
bindings-local: solc-all abigen-all

bindings-lin: install-solc-lin solc-all install-abigen-lin abigen-all

bindings-mac: install-solc-mac solc-all install-abigen-mac abigen-all

bindings-cache: solc-all abigen-all

bindings-docker: install-solc-lin solc-all install-abigen-lin abigen-all
Loading

0 comments on commit ce62de0

Please sign in to comment.