Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Feb 19, 2024
2 parents f929e15 + 2c2b773 commit 785d151
Show file tree
Hide file tree
Showing 66 changed files with 5,738 additions and 1,682 deletions.
40 changes: 39 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
{
"words": ["WXDAI"]
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "/lib"],
"useGitignore": true,
"language": "en",
"words": [
"solmate",
"binkey",
"binsec",
"cirip",
"dataurl",
"devpool",
"ethersproject",
"fract",
"gnosisscan",
"godb",
"greyscale",
"IERC",
"keccak",
"keypair",
"libsodium",
"Numberish",
"outdir",
"Rpcs",
"scalarmult",
"servedir",
"sonarjs",
"typebox",
"TYPEHASH",
"ubiquibot",
"UBIQUIBOT",
"URLSAFE",
"WXDAI",
"XDAI",
"xmark"
],
"dictionaries": ["typescript", "node", "software-terms", "html"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
}
108 changes: 108 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint", "sonarjs"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
"ignorePatterns": ["**/*.js"],
"rules": {
"prefer-arrow-callback": [
"warn",
{
"allowNamedFunctions": true
}
],
"func-style": [
"warn",
"declaration",
{
"allowArrowFunctions": false
}
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"constructor-super": "error",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"no-restricted-syntax": ["error", "ForInStatement"],
"use-isnan": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"ignoreRestSiblings": true,
"vars": "all",
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"sonarjs/no-all-duplicated-branches": "error",
"sonarjs/no-collection-size-mischeck": "error",
"sonarjs/no-duplicated-branches": "error",
"sonarjs/no-element-overwrite": "error",
"sonarjs/no-identical-conditions": "error",
"sonarjs/no-identical-expressions": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "typeParameter",
"format": ["PascalCase"],
"prefix": ["T"]
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "variable",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "variable",
"modifiers": ["destructured"],
"format": null
},
{
"selector": "variable",
"types": ["boolean"],
"format": ["PascalCase"],
"prefix": ["is", "should", "has", "can", "did", "will", "does"]
},
{
"selector": "variableLike",
"format": ["camelCase"]
},
{
"selector": ["function", "variable"],
"format": ["camelCase"]
}
]
}
}
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Resolves #

<!--
- You must link the issue number e.g. "Resolves #1234"
- Please do not replace the keyword "Resolves" https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
67 changes: 36 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
name: Build
name: Build & Deploy

on:
push:
branches:
- development
pull_request:
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check out repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Yarn Install
run: yarn install
node-version: 20.10.0

- name: Build
run: yarn utils:build

- name: Add commit SHA file to build folder
run: echo -n $(echo "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) > static/commit.txt

- name: Prepare Deployment Artifact
env:
EVENT_NAME: ${{github.event_name}}
PR_NUMBER: ${{ github.event.number }}
SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
run: |
echo "event_name=$EVENT_NAME,pr_number=$PR_NUMBER,sha=$SHA"
mkdir -p ./pr
echo "event_name=$EVENT_NAME,pr_number=$PR_NUMBER,sha=$SHA," > ./pr/pr_number
cd ./static && zip -r ../pr/pull-request.zip ./*
yarn
yarn build
echo -n $(echo "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) > static/commit.txt
- uses: actions/upload-artifact@v3
- name: Check Cloudflare API Token
id: check_token
run: |
if [[ -z "${{ secrets.CLOUDFLARE_API_TOKEN }}" ]]; then
echo "Cloudflare API token is not set. Skipping deployment."
echo "skip=true" >> $GITHUB_ENV
else
echo "skip=false" >> $GITHUB_ENV
fi
shell: bash

- name: Deploy to Cloudflare
if: env.skip != 'true'
uses: ubiquity/cloudflare-deploy-action@main
with:
name: pr
path: pr/
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
output_directory: "static"
current_branch: ${{ github.ref_name }}
pull_request_number: ${{ github.event.pull_request.number }}
commit_sha: ${{ github.sha }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
app_id: ${{ secrets.APP_ID }}
app_installation_id: ${{ secrets.APP_INSTALLATION_ID }}
# Add any environment variables you need to pass along here
# SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
# SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
38 changes: 0 additions & 38 deletions .github/workflows/continuous-deploy.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Conventional Commits

on:
push:

jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ubiquity/action-conventional-commits@master
24 changes: 24 additions & 0 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Spell Check

on:
push:

jobs:
spellcheck:
name: Check for spelling errors
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Install cspell
run: yarn add cspell

- name: Run cspell
run: yarn format:cspell
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ out
.yarn
.DS_Store
commit.txt
# macOS
# node
# yarn2
.pnp.cjs
.pnp.loader.mjs
static/dist
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
[submodule "lib/permit2"]
path = lib/permit2
url = https://github.com/Uniswap/permit2
[submodule "lib/ubiquibot"]
path = lib/ubiquibot
url = https://github.com/ubiquity/ubiquibot
shallow = true
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
/lib
12 changes: 5 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"useTabs": false,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "avoid",
"singleQuote": false,
"printWidth": 160,
"proseWrap": "preserve",
"tabWidth": 2,
"htmlWhitespaceSensitivity": "strict",
"singleQuote": false
"plugins": [],
"useTabs": false
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ http://localhost:8080?claim=eyJwZXJtaXQiOnsicGVybWl0dGVkIjp7InRva2VuIjoiMHgxMWZF

This section describes how to invalidate the following [permit](https://github.com/ubiquity/ubiquity-dollar/issues/643#issuecomment-1607152588) (i.e. invalidate a permit2 nonce)

1. Setup `.env` file with the required env varibales: `NONCE` (nonce number), `NONCE_SIGNER_ADDRESS` (i.e. the bot's wallet) and `RPC_PROVIDER_URL`. For this [permit URL](https://github.com/ubiquity/ubiquity-dollar/issues/643#issuecomment-1607152588) the `.env` file will look like this:
1. Setup `.env` file with the required env variables: `NONCE` (nonce number), `NONCE_SIGNER_ADDRESS` (i.e. the bot's wallet) and `RPC_PROVIDER_URL`. For this [permit URL](https://github.com/ubiquity/ubiquity-dollar/issues/643#issuecomment-1607152588) the `.env` file will look like this:

```
NONCE="9867970486646789738815952475601005014850694197864057371518032581271992954680"
Expand Down
Loading

0 comments on commit 785d151

Please sign in to comment.