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

feat: list verification pipeline v1 #3

Merged
merged 15 commits into from
Aug 22, 2024
23 changes: 23 additions & 0 deletions .github/workflows/token-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Token validation
on: [ pull_request ]

jobs:
validate_token_schema:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Validate Spectra Tokens
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: src/schema/spectraTokens.schema.json
INPUT_JSONS: src/tokens/spectraTokens.json,src/tokens/erc4626Wrappers.json

- name: Validate Protocol List
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: src/schema/protocolList.schema.json
INPUT_JSONS: src/protocols/protocolList.json
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea
/node_modules
/node_modules
/dist
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"gen:4626-token-list": "SCRIPT=true npx bun run ./src/scripts/compileERC4626TokenList/index.ts",
"gen:purge-token-list": "SCRIPT=true npx bun run ./src/scripts/purgeTokenList/index.ts"
},
"keywords": [],
"keywords": [
"spectral",
"token",
"list",
"schema",
"protocol"
],
"author": "",
"license": "ISC",
"dependencies": {
Expand Down
71 changes: 71 additions & 0 deletions src/schema/protocolList.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"ptAddress",
"chainId",
"protocolName",
"token",
"multipliers"
],
"properties": {
"ptAddress": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"chainId": {
"type": "integer"
},
"protocolName": {
"type": "string"
},
"bgUrl": {
"type": "string"
},
"token": {
"type": "object",
"additionalProperties": false,
"required": [
"symbol",
"logoURI",
"underlying"
],
"properties": {
"symbol": {
"type": "string"
},
"logoURI": {
"type": "string"
},
"underlying": {
"type": "string"
}
}
},
"multipliers": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"amount",
"name"
],
"properties": {
"amount": {
"type": "number",
"minimum": 1,
"maximum": 1000
},
"name": {
"type": "string"
}
}
}
}
}
}
}
121 changes: 121 additions & 0 deletions src/schema/spectraTokens.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"chainId",
"address",
"name",
"symbol",
"decimals",
"logoURI"
],
"properties": {
"chainId": {
"type": "integer"
},
"address": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"name": {
"type": "string"
},
"symbol": {
"type": "string"
},
"decimals": {
"type": "integer",
"minimum": 1,
"maximum": 18
},
"logoURI": {
"type": "string"
},
"extensions": {
"type": "object",
"additionalProperties": false,
"properties": {
"underlying": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
},
}, "externalLink": { "type": "string", "pattern": "https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)" },

Can we add this extension: externalLink 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have the externalLink already (line 48) but I will extend it by the pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change the regex and provided one doesn't work for our current value

"protocol": {
"type": "string"
},
"externalLink": {
"type": "string",
"pattern": "(http|https)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?"
},
"faucetAddress": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"aprEndpoint": {
"type": "string"
},
"negativeYield": {
"type": "boolean"
},
"tokenOut": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"ibtRoutes": {
"type": "object",
"additionalProperties": false,
"properties": {
"deposit": {
"type": "boolean"
},
"mint": {
"type": "boolean"
},
"withdraw": {
"type": "boolean"
},
"redeem": {
"type": "boolean"
},
"createPool": {
"type": "boolean"
},
"unwrap": {
"type": "boolean"
}
}
},
"vault": {
"type": "object",
"additionalProperties": false,
"properties": {
"chainId": {
"type": "integer"
},
"address": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"name": {
"type": "string"
},
"symbol": {
"type": "string"
},
"decimals": {
"type": "integer",
"minimum": 1,
"maximum": 18
},
"logoURI": {
"type": "string"
}
}
}
}
}
}
}
}
Loading
Loading