Skip to content

Commit

Permalink
Merge branch 'main' of github.com:switchboard-xyz/ecosystem
Browse files Browse the repository at this point in the history
  • Loading branch information
jessupjn committed Sep 26, 2024
2 parents cfa497b + f30424e commit 63a55af
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .compiled/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import fs from "fs";
import Joi from "joi";
import { parse } from "jsonc-parser";
import path from "path";

const IN_DIR = path.join(__dirname, "../projects");
const OUT_PATH = path.join(__dirname, "projects.json");

/**
* The data schema for an "Ecosystem Project".
*/
const projectSchema = Joi.object({
date: Joi.string().min(1).required(),
name: Joi.string().min(1).required(),
brief: Joi.string().min(1).required(),
img: Joi.string().min(1).required(),
website: Joi.string().min(1).required(),
x: Joi.string().optional(),
github: Joi.string().optional(),
telegram: Joi.string().optional(),
discord: Joi.string().optional(),
});

console.log();
const projectList = [];
fs.readdirSync(IN_DIR).forEach((file, idx) => {
if (file.endsWith(".json") || file.endsWith(".jsonc")) {
try {
// Iterate each project file and load the content to be checked.
const filePath = path.join(IN_DIR, file);
const fileContent = fs.readFileSync(filePath, "utf8");

// Step 1: Convert JSONC data into JSON.
const parsedData = parse(fileContent);

// Step 2: Validate the JSON against our Joi schema.
const validated = projectSchema.validate(parsedData, {
stripUnknown: true,
});
if (validated.error) throw validated.error;
else if (validated.warning) throw validated.warning;

// Step 3: The json has been validated. Transform the `img` path into a complete url.
validated.value.img = path.join(
`https://raw.githubusercontent.com/switchboard-xyz/ecosystem/main`,
validated.value.img
);

console.log(`Successfully validated: ${file}`);
projectList.push(validated.value);
} catch (error) {
console.error(`Error parsing ${file}:`, error);
}
} else {
console.error(`File ${idx} is not of type .json or .jsonc: ${file}`);
}
});

fs.rmSync(OUT_PATH, { force: true });
fs.writeFileSync(OUT_PATH, JSON.stringify(projectList, null, 2));
console.log();
console.log("---");
console.log("Consolidated JSON file created successfully.");
111 changes: 111 additions & 0 deletions .compiled/projects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[
{
"date": "2024-05-22",
"name": "Kamino",
"brief": "Automated concentrated liquidity (CLMM) position management.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/kamino.jpg",
"website": "https://kamino.finance/",
"x": "https://x.com/KaminoFinance",
"github": "https://github.com/Kamino-Finance",
"discord": "https://discord.com/invite/kaminofinance"
},
{
"date": "2024-05-23",
"name": "Lulo",
"brief": "Your DeFi Savings Account.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/lulo.jpg",
"website": "https://lulo.fi/",
"x": "https://x.com/uselulo",
"github": "https://github.com/lulo-labs",
"discord": "https://discord.gg/lulo"
},
{
"date": "2024-05-24",
"name": "Rain.fi",
"brief": "Borrow, lend and long tokens and NFTs in the simplest way. No price liquidations.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/rainfi.jpg",
"website": "https://rain.fi/",
"x": "https://x.com/RainFi_",
"discord": "https://discord.gg/rainfi"
},
{
"date": "2024-05-23",
"name": "AllDomains",
"brief": "The web3 identity asset layer to create and trade web3 domains",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/alldomains.jpg",
"website": "https://alldomains.id/",
"x": "https://x.com/AllDomains_",
"github": "https://github.com/onsol-labs",
"discord": "https://discord.gg/Rcrqhs7Bja"
},
{
"date": "2024-05-22",
"name": "GooseFX",
"brief": "A Complete DeFi Experience.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/goosefx.jpg",
"website": "https://goosefx.io/",
"x": "https://x.com/GooseFX1",
"github": "https://github.com/GooseFX1",
"discord": "https://discord.com/invite/cDEPXpY26q"
},
{
"date": "2024-05-22",
"name": "Solend",
"brief": "Solend is the autonomous interest rate machine for lending on Solana.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/solend.jpg",
"website": "https://solend.fi",
"x": "https://x.com/solendprotocol",
"github": "https://github.com/solendprotocol",
"discord": "https://discord.gg/solend"
},
{
"date": "2024-05-22",
"name": "Hubble Protocol",
"brief": "Borrowing platform that issues the USDH stablecoin against your crypto assets.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/hubble.jpg",
"website": "https://hubbleprotocol.io/",
"x": "https://x.com/hubbleprotocol",
"github": "https://github.com/hubbleprotocol/",
"discord": "https://discord.gg/MGujjftKTY"
},
{
"date": "2024-05-22",
"name": "Marginfi",
"brief": "The liquidity layer for Solana.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/marginfi.jpg",
"website": "https://www.marginfi.com/",
"x": "https://x.com/marginfi",
"github": "https://github.com/mrgnlabs/",
"discord": "https://discord.gg/mrgn"
},
{
"date": "2024-05-23",
"name": "Symmetry",
"brief": "On-chain asset management infrastructure",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/symmetry.jpeg",
"website": "https://symmetry.fi/",
"x": "https://x.com/symmetry_fi",
"github": "https://github.com/symmetry-protocol",
"discord": "https://discord.symmetry.fi"
},
{
"date": "2024-05-20",
"name": "Drift Protocol",
"brief": "Drift brings on-chain, cross-margined perpetual swaps to Solana.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/drift.jpg",
"website": "https://www.drift.trade",
"x": "https://x.com/driftprotocol",
"github": "https://github.com/drift-labs",
"discord": "https://discord.com/invite/fMcZBH8ErM"
},
{
"date": "2024-05-22",
"name": "Mango Markets",
"brief": "Lend, borrow, swap, and leverage-trade crypto assets - permissionless and all on-chain.",
"img": "https:/raw.githubusercontent.com/switchboard-xyz/ecosystem/main/img/mango.jpg",
"website": "https://mango.markets/",
"x": "https://x.com/mangomarkets",
"github": "https://github.com/blockworks-foundation/",
"discord": "https://discord.com/invite/mangomarkets"
}
]
11 changes: 11 additions & 0 deletions .github/workflows/consolidate-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ jobs:

- name: Install dependencies
run: bun install

- name: Compile project list
run: bun run .compiled/compile.js

- name: Commit consolidated JSON
run: |
git config --global user.name 'MrEnclave[bot]'
git config --global user.email 'MrEnclave[bot]@noreply.switchboard.xyz'
git add .
git commit -m 'Mr. Enclave compiles project data.'
git push
Binary file modified bun.lockb
Binary file not shown.
Binary file added img/alldomains.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/rainfi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions projects/alldomains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"date": "2024-05-23",
"name": "AllDomains",
"brief": "The web3 identity asset layer to create and trade web3 domains",
"img": "/img/alldomains.jpg",
"website": "https://alldomains.id/",
"x": "https://x.com/AllDomains_",
"github": "https://github.com/onsol-labs",
"discord": "https://discord.gg/Rcrqhs7Bja"
}
9 changes: 9 additions & 0 deletions projects/rainfi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"date": "2024-05-24",
"name": "Rain.fi",
"brief": "Borrow, lend and long tokens and NFTs in the simplest way. No price liquidations.",
"img": "/img/rainfi.jpg",
"website": "https://rain.fi/",
"x": "https://x.com/RainFi_",
"discord": "https://discord.gg/rainfi"
}

0 comments on commit 63a55af

Please sign in to comment.