Skip to content

Commit

Permalink
environment improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlitvin committed Jan 21, 2025
1 parent a3ff5cf commit 4a7c5dd
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 34 deletions.
74 changes: 41 additions & 33 deletions packages/api/src/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mainnet, sepolia, cannon } from "viem/chains";
import { mainnet, sepolia, base, cannon } from "viem/chains";
import evmIndexer from "./resourcePriceFunctions/evmIndexer";
import celestiaIndexer from "./resourcePriceFunctions/celestiaIndexer";
import { Deployment, MarketInfo } from "./interfaces";
Expand All @@ -25,40 +25,48 @@ export const RESOURCES = [
},
];

const addMarketYinYang = async (
markets: MarketInfo[],
chainId: number
) => {
const yin = await safeRequire(`@/protocol/deployments/${chainId}/FoilYin.json`);
const yang = await safeRequire(`@/protocol/deployments/${chainId}/FoilYang.json`);

if (yin && yang) {
markets.push(
{
deployment: yin,
marketChainId: chainId,
public: true,
resource: RESOURCES[0], // Ethereum Gas
},
{
deployment: yang,
marketChainId: chainId,
public: true,
resource: RESOURCES[0], // Ethereum Gas
}
);
}
};

const initializeMarkets = async () => {
const FULL_MARKET_LIST = [
/*
{
name: "Development Gas",
deployment: await safeRequire(
"@/protocol/deployments/13370/FoilYin.json"
),
marketChainId: cannon.id,
public: true,
resource: RESOURCES[0], // Ethereum Gas
},
*/
{
deployment: await safeRequire(
"@/protocol/deployments/11155111/FoilYin.json"
),
marketChainId: sepolia.id,
public: true,
resource: RESOURCES[0], // Ethereum Gas
},
{
deployment: await safeRequire(
"@/protocol/deployments/11155111/FoilYang.json"
),
marketChainId: sepolia.id,
public: true,
resource: RESOURCES[0], // Ethereum Gas
},
];
const FULL_MARKET_LIST: MarketInfo[] = [];

// Mainnet Deployments
await addMarketYinYang(FULL_MARKET_LIST, base.id);

// Development Deployments
if (process.env.NODE_ENV === "development") {
await addMarketYinYang(FULL_MARKET_LIST, cannon.id);
}

// Testnet Deployments
if (process.env.NODE_ENV === "staging" || process.env.NODE_ENV === "development") {
await addMarketYinYang(FULL_MARKET_LIST, sepolia.id);
}

return FULL_MARKET_LIST.filter(
(market) => market.deployment !== null
) as MarketInfo[];
return FULL_MARKET_LIST;
};

export const MARKETS = await initializeMarkets();
8 changes: 7 additions & 1 deletion packages/api/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,13 @@ const startServer = async () => {
let id: string = "";
const renderServices: any[] = await fetchRenderServices();
for (const item of renderServices) {
if (item?.service?.name === "background-worker" && item?.service?.id) {
if (
item?.service?.type === "background_worker" &&
item?.service?.id &&
(process.env.NODE_ENV === "staging"
? item?.service?.branch === "staging"
: item?.service?.branch === "main")
) {
id = item?.service.id;
break;
}
Expand Down

0 comments on commit 4a7c5dd

Please sign in to comment.