Skip to content

Commit

Permalink
feat: platform list validation
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed Aug 15, 2024
1 parent 8b1def4 commit eebe906
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 8 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/token-validation.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Token validation
on: [pull_request]
on: [ pull_request ]

jobs:
validate:
validate_token_schema:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -14,4 +14,10 @@ jobs:
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
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
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
70 changes: 70 additions & 0 deletions src/schema/protocolList.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"ptAddress",
"chainId",
"protocolName",
"bgUrl",
"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",
"pattern": "^0x[a-fA-F0-9]{40}$"
}
}
},
"multipliers": {
"type": "object",
"minimum": 1,
"maximum": 1000
}
},
"multipliers": [
{
"amount": 1.5,
"name": "Karak XP"
},
{
"amount": 2,
"name": "Ether.fi Points"
},
{
"amount": 1,
"name": "EigenLayer Points"
}
]
}

0 comments on commit eebe906

Please sign in to comment.