Skip to content

Commit

Permalink
Merge pull request #2249 from zeitgeistpm/tr-enable-usdc
Browse files Browse the repository at this point in the history
Enable USDC + Full leaderboards
  • Loading branch information
Robiquet authored Feb 8, 2024
2 parents f65e9f7 + e466fbb commit c3ca957
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
16 changes: 8 additions & 8 deletions lib/constants/foreign-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
14 changes: 7 additions & 7 deletions lib/constants/supported-currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
12 changes: 7 additions & 5 deletions lib/gql/historical-prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ export const getBaseAssetHistoricalPrices = async (): Promise<BasePrices> => {
"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()));
Expand Down
2 changes: 1 addition & 1 deletion lib/state/market-creation/constants/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import { SupportedCurrencyTag } from "lib/constants/supported-currencies";
export const minBaseLiquidity: Record<SupportedCurrencyTag, number> = {
ZTG: 200,
DOT: 10,
// USDC: 50,
USDC: 50,
};
7 changes: 3 additions & 4 deletions pages/leaderboard/[period].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit c3ca957

Please sign in to comment.