Skip to content

Commit

Permalink
added categories to existing protocols (#70)
Browse files Browse the repository at this point in the history
* add category to protocol config (#69)

* add category to protocol config

* update readme

---------

Co-authored-by: Manh Cao <[email protected]>
Co-authored-by: Manh Cao <[email protected]>

* Merge JSON files

* added categories to existing protocols

* added categories to existing protocols

* case insensitive and force user to enter category

* update config.json main

---------

Co-authored-by: manh-pendle <[email protected]>
Co-authored-by: Manh Cao <[email protected]>
Co-authored-by: Manh Cao <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Nov 25, 2024
1 parent 53e6345 commit 68be2e3
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The YAML file includes details for multiple objects (PT, YT, LP), each correspon

- name: The name of the protocol.
- icon: The protocol’s logo (circular logo in PNG). The string on this field should be the same as the name of the logo file uploaded. Size limit for logo is 20KB.
- category: The protocol's category. It must belong to one of the following categories: `money market`, `vault` or `liquid locker`. If no category is specified, the protocol will automatically default to the `others` type.
- category: The protocol's category. It must belong to one of the following categories: `Money Market`, `Yield Strategy`, `Liquid Locker` or `Others`.
- metadata: This section contains detailed information about the protocol's integration assets.

#### Asset fields
Expand All @@ -26,7 +26,7 @@ The YAML file includes details for multiple objects (PT, YT, LP), each correspon
```yaml
name: Protocol Name 2
icon: logo.png
category: 'vault'
category: 'Yield Strategy'
metadata:
pt:
- chainId: 1
Expand Down
5 changes: 2 additions & 3 deletions const.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const DEFAULT_PROTOCOL_CATEGORY = 'others';
const PROTOCOL_CATEGORIES = ['money market', 'vault', 'liquid locker'];
// categories need to be lowercase strings
const PROTOCOL_CATEGORIES = ['money market', 'yield strategy', 'liquid locker', 'others'];

module.exports = {
DEFAULT_PROTOCOL_CATEGORY,
PROTOCOL_CATEGORIES,
}
3 changes: 1 addition & 2 deletions merge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const yaml = require("js-yaml");
const {DEFAULT_PROTOCOL_CATEGORY} = require("./const");

async function run() {
const protocolsPath = path.join(__dirname, 'protocols');
Expand Down Expand Up @@ -59,7 +58,7 @@ function formatProtocolConfig(config) {
id,
name,
icon,
category: category ?? DEFAULT_PROTOCOL_CATEGORY,
category: category.toLowerCase(),
metadata: {
pt: formatMetadataAssets(pt),
yt: formatMetadataAssets(yt),
Expand Down
1 change: 1 addition & 0 deletions protocols/avalon-finance/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Avalon Finance
icon: logo.png
category: Money Market
metadata:
pt:
# Ethereum PT-corn-SolvBTC.BBN-26DEC2024
Expand Down
1 change: 1 addition & 0 deletions protocols/beefy/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Beefy
icon: logo.png
category: Yield Strategy
metadata:
pt: []
yt: []
Expand Down
1 change: 1 addition & 0 deletions protocols/cega/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Cega
icon: logo.png
category: Yield Strategy
metadata:
pt: []
yt:
Expand Down
1 change: 1 addition & 0 deletions protocols/contango/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Contango
icon: logo.png
category: Yield Strategy
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/euler/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Euler
icon: logo.png
category: Money Market
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/form/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Form
icon: logo.png
category: Others
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/index-coop/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Index Coop
icon: logo.png
category: Yield Strategy
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/marginly/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Marginly
icon: marginly-logo.png
category: Yield Strategy
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/morpho/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Morpho
icon: logo.png
category: Money Market
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/origami/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Origami
icon: logo.png
category: Yield Strategy
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/pichi/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Pichi
icon: logo.png
category: Others
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/silo/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Silo
icon: logo.png
category: Money Market
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/timeswap/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Timeswap
icon: logo.png
category: Money Market
metadata:
pt:
- chainId: 42161
Expand Down
1 change: 1 addition & 0 deletions protocols/venus/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Venus Protocol
icon: venus.png
category: Money Market
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/yearn/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: yearn
icon: logo.png
category: Yield Strategy
metadata:
pt:
- chainId: 1
Expand Down
1 change: 1 addition & 0 deletions protocols/zerolend/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ZeroLend
icon: logo.png
category: Money Market
metadata:
pt:
- chainId: 1
Expand Down
8 changes: 2 additions & 6 deletions validate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ function isKebabCase(str) {
}

function validateCategory(protocol, category) {
if (category === undefined) {
return;
}

if (!mustBeNonEmptyString(category) || !PROTOCOL_CATEGORIES.includes(category)) {
throw new Error(`protocol ${protocol}: invalid field 'category', category must be one of the values (${PROTOCOL_CATEGORIES.join(', ')}) or left unset`);
if (!mustBeNonEmptyString(category) || !PROTOCOL_CATEGORIES.includes(category.toLowerCase())) {
throw new Error(`protocol ${protocol}: invalid field 'category', category must be case-insensitive one of the values (${PROTOCOL_CATEGORIES.join(', ')})`);
}
}

Expand Down

0 comments on commit 68be2e3

Please sign in to comment.