From eebe906a4d44dbb690d78b6cad81abed5661aa25 Mon Sep 17 00:00:00 2001 From: matstyler Date: Thu, 15 Aug 2024 19:27:14 +0200 Subject: [PATCH] feat: platform list validation --- .github/workflows/token-validation.yml | 12 +++-- package.json | 12 +++-- src/schema/protocolList.schema.json | 70 ++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 src/schema/protocolList.schema.json diff --git a/.github/workflows/token-validation.yml b/.github/workflows/token-validation.yml index 4ff3d7e..ae45312 100644 --- a/.github/workflows/token-validation.yml +++ b/.github/workflows/token-validation.yml @@ -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 @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/package.json b/package.json index 9040699..aa10174 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/schema/protocolList.schema.json b/src/schema/protocolList.schema.json new file mode 100644 index 0000000..dfca347 --- /dev/null +++ b/src/schema/protocolList.schema.json @@ -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" + } + ] + }