fix dex market

This commit is contained in:
jordansexton 2021-06-25 17:05:29 -05:00
parent 11d8ba6047
commit 1256f4e076
3 changed files with 48 additions and 6 deletions

View File

@ -26,7 +26,7 @@ import { MINT_TO_MARKET } from './../models/marketOverrides';
const { useConnectionConfig } = contexts.Connection; const { useConnectionConfig } = contexts.Connection;
const { cache, getMultipleAccounts } = contexts.Accounts; const { cache, getMultipleAccounts } = contexts.Accounts;
const INITAL_LIQUIDITY_DATE = new Date('2020-10-27'); const INITIAL_LIQUIDITY_DATE = new Date('2021-06-21');
export const BONFIDA_POOL_INTERVAL = 30 * 60_000; // 30 min export const BONFIDA_POOL_INTERVAL = 30 * 60_000; // 30 min
interface RecentPoolData { interface RecentPoolData {
@ -74,7 +74,7 @@ export function MarketProvider({ children = null as any }) {
); );
const marketAddress = MINT_TO_MARKET[mintAddress]; const marketAddress = MINT_TO_MARKET[mintAddress];
const marketName = `${SERUM_TOKEN?.name}/USDC`; const marketName = `${SERUM_TOKEN?.name}/USDT`;
const marketInfo = MARKETS.find( const marketInfo = MARKETS.find(
m => m.name === marketName || m.address.toBase58() === marketAddress, m => m.name === marketName || m.address.toBase58() === marketAddress,
); );
@ -383,7 +383,7 @@ function createEnrichedPools(
// Aproximation not true for all pools we need to fine a better way // Aproximation not true for all pools we need to fine a better way
const daysSinceInception = Math.floor( const daysSinceInception = Math.floor(
(TODAY.getTime() - INITAL_LIQUIDITY_DATE.getTime()) / (TODAY.getTime() - INITIAL_LIQUIDITY_DATE.getTime()) /
(24 * 3600 * 1000), (24 * 3600 * 1000),
); );
const apy0 = const apy0 =

View File

@ -21,7 +21,7 @@ export const OrderBookParser = (id: PublicKey, acc: AccountInfo<Buffer>) => {
// Mainnet Beta: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin // Mainnet Beta: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
const DEFAULT_DEX_ID = new PublicKey( const DEFAULT_DEX_ID = new PublicKey(
'DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY', '9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin',
); );
export const DexMarketParser = ( export const DexMarketParser = (

View File

@ -1,2 +1,44 @@
// use to override serum market to use specifc mint import { MARKETS, TOKEN_MINTS } from "@project-serum/serum";
export const MINT_TO_MARKET: { [key: string]: string } = {}; import { PublicKey } from "@solana/web3.js";
// @FIXME: overrides should be limited to devnet
// use to override serum market to use specific mint
export const MINT_TO_MARKET: { [key: string]: string } = {
// SOL/USDT
"So11111111111111111111111111111111111111112": "8RJA4WhY2Ei48c4xANSgPoqw7DU7mRgvg6eqJS3tvLEN",
// SRM/USDT
"9FbAMDvXqNjPqZSYt4EWTguJuDrGkfvwr3gSFpiSbX9S": "CRLpSnSf7JkoJi9tUnz55R2FoTCrDDkWxQMU6uSVBQgc",
};
TOKEN_MINTS.length = 0;
TOKEN_MINTS.push(
{
address: new PublicKey("7KBVenLz5WNH4PA5MdGkJNpDDyNKnBQTwnz1UqJv9GUm"),
name: "USDT",
},
{
address: new PublicKey("9FbAMDvXqNjPqZSYt4EWTguJuDrGkfvwr3gSFpiSbX9S"),
name: "SRM",
},
{
address: new PublicKey("So11111111111111111111111111111111111111112"),
name: "SOL",
}
);
MARKETS.length = 0;
MARKETS.push(
{
address: new PublicKey("8RJA4WhY2Ei48c4xANSgPoqw7DU7mRgvg6eqJS3tvLEN"),
name: "SOL/USDT",
programId: new PublicKey("DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY"),
deprecated: false,
},
{
address: new PublicKey("CRLpSnSf7JkoJi9tUnz55R2FoTCrDDkWxQMU6uSVBQgc"),
name: "SRM/USDT",
programId: new PublicKey("DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY"),
deprecated: false,
}
);