From c72ad57fd39df9aa4c6eac0307dabdd9ece18801 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Thu, 8 Feb 2024 19:25:07 +0200 Subject: [PATCH 1/2] enable usdc --- lib/constants/foreign-asset.ts | 16 ++++++++-------- lib/constants/supported-currencies.ts | 14 +++++++------- lib/state/market-creation/constants/currency.ts | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/constants/foreign-asset.ts b/lib/constants/foreign-asset.ts index 295d5af96..3d2a5a767 100644 --- a/lib/constants/foreign-asset.ts +++ b/lib/constants/foreign-asset.ts @@ -72,14 +72,14 @@ const PROD_FOREIGN_ASSET_METADATA: ForeignAssetMetadata = { tokenSymbol: "DOT", subsquidId: "DOT", }, - // 1: { - // originChain: "Moonbeam", - // image: "/currencies/usdc.svg", - // withdrawSupported: false, - // coinGeckoId: "usd", - // tokenSymbol: "USDC", - // subsquidId: "USDC", - // }, + 1: { + originChain: "Moonbeam", + image: "/currencies/usdc.svg", + withdrawSupported: false, + coinGeckoId: "usd", + tokenSymbol: "USDC", + subsquidId: "USDC", + }, }; export const FOREIGN_ASSET_METADATA: ForeignAssetMetadata = diff --git a/lib/constants/supported-currencies.ts b/lib/constants/supported-currencies.ts index cb7ad7924..bfa872352 100644 --- a/lib/constants/supported-currencies.ts +++ b/lib/constants/supported-currencies.ts @@ -26,13 +26,13 @@ export const supportedCurrencies = [ twColor: "polkadot", assetId: { ForeignAsset: 0 } as const, } satisfies CurrencyMetadata, - // { - // name: "USDC" as const, - // description: "Create market with Moonbeam USDC.wh as the base asset.", - // image: "/currencies/usdc.svg", - // twColor: "usdc", - // assetId: { ForeignAsset: 1 } as const, - // } satisfies CurrencyMetadata, + { + name: "USDC" as const, + description: "Create market with Moonbeam USDC.wh as the base asset.", + image: "/currencies/usdc.svg", + twColor: "usdc", + assetId: { ForeignAsset: 1 } as const, + } satisfies CurrencyMetadata, ] as const; export type SupportedCurrencyTag = Unpacked< diff --git a/lib/state/market-creation/constants/currency.ts b/lib/state/market-creation/constants/currency.ts index 3a78cf026..4a4eb4073 100644 --- a/lib/state/market-creation/constants/currency.ts +++ b/lib/state/market-creation/constants/currency.ts @@ -8,5 +8,5 @@ import { SupportedCurrencyTag } from "lib/constants/supported-currencies"; export const minBaseLiquidity: Record = { ZTG: 200, DOT: 10, - // USDC: 50, + USDC: 50, }; From e466fbb31d7c4fe9183e304fdd4c76c3d7ad3494 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Thu, 8 Feb 2024 19:41:23 +0200 Subject: [PATCH 2/2] enable full leaderboard --- lib/gql/historical-prices.ts | 12 +++++++----- pages/leaderboard/[period].tsx | 7 +++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/gql/historical-prices.ts b/lib/gql/historical-prices.ts index d20628821..92c08c87c 100644 --- a/lib/gql/historical-prices.ts +++ b/lib/gql/historical-prices.ts @@ -32,12 +32,14 @@ export const getBaseAssetHistoricalPrices = async (): Promise => { "zeitgeist", ]; + const generateUrl = COIN_GECKO_API_KEY + ? (id: string) => + `https://pro-api.coingecko.com/api/v3/coins/${id}/market_chart?vs_currency=usd&days=10000&x_cg_pro_api_key=${COIN_GECKO_API_KEY}` + : (id: string) => + `https://api.coingecko.com/api/v3/coins/${id}/market_chart?vs_currency=usd&days=10000`; + const pricesRes = await Promise.all( - coinGeckoIds.map((id) => - fetch( - `https://api.coingecko.com/api/v3/coins/${id}/market_chart?vs_currency=usd&days=10000&${COIN_GECKO_API_KEY}`, - ), - ), + coinGeckoIds.map((id) => fetch(generateUrl(id))), ); const prices = await Promise.all(pricesRes.map((res) => res.json())); diff --git a/pages/leaderboard/[period].tsx b/pages/leaderboard/[period].tsx index 049dd9126..11108c59e 100644 --- a/pages/leaderboard/[period].tsx +++ b/pages/leaderboard/[period].tsx @@ -48,15 +48,14 @@ import { useMemo } from "react"; // "In events": swaps, buy full set // "Out events": swaps, sell full set, redeem -// const TimePeriodItems = ["month", "year", "all"] as const; -const TimePeriodItems = ["year"] as const; +const TimePeriodItems = ["month", "year", "all"] as const; type TimePeriod = (typeof TimePeriodItems)[number]; const durationLookup: { [key in TimePeriod]: number } = { // week: DAY_SECONDS * 1000 * 7, - // month: DAY_SECONDS * 1000 * 30, + month: DAY_SECONDS * 1000 * 30, year: DAY_SECONDS * 1000 * 365, - // all: DAY_SECONDS * 1000 * 365 * 100, + all: DAY_SECONDS * 1000 * 365 * 100, }; type Trade = {