diff --git a/src/components/LiquidatedVaultsTable.tsx b/src/components/LiquidatedVaultsTable.tsx index 499a483..8337dc5 100644 --- a/src/components/LiquidatedVaultsTable.tsx +++ b/src/components/LiquidatedVaultsTable.tsx @@ -50,26 +50,26 @@ export const columns: DataColumn[] = [ type: 'number', header: 'IST Debt Amount', }, - // { - // accessorKey: 'liquidation_margin_avg', - // type: 'percent', - // header: 'Liquidation Ratio', - // }, - // { - // accessorKey: 'liquidating_rate', - // type: 'usd', - // header: 'Liquidation Price', - // }, + { + accessorKey: 'liquidation_margin_avg', + type: 'percent', + header: 'Liquidation Ratio', + }, + { + accessorKey: 'liquidating_rate', + type: 'usd', + header: 'Liquidation Price', + }, { accessorKey: 'liquidated_return_amount', type: 'number', header: 'Collateral Returned Amount', }, - // { - // accessorKey: 'liquidated_return_amount_usd', - // type: 'usd', - // header: 'Collateral Returned ($USD)', - // }, + { + accessorKey: 'liquidated_return_amount_usd', + type: 'usd', + header: 'Collateral Returned ($USD)', + }, ]; export function LiquidatedVaultsTable({ data }: Props) { diff --git a/src/constants.ts b/src/constants.ts index 6b731fa..1ae3fc9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -11,7 +11,6 @@ export const VBANK_RESERVE_ACCOUNT = 'vbank/reserve'; export const GRAPH_DAYS = 90; export const SUBQUERY_URL = 'https://api.subquery.network/sq/agoric-labs/agoric-mainnet-v2'; -export const SUBQUERY_STAGING_URL = 'https://api.subquery.network/sq/agoric-labs/agoric-mainnet-v2'; export const enum VAULT_STATES { ACTIVE = 'active', diff --git a/src/pages/Liquidated.tsx b/src/pages/Liquidated.tsx index 4d5431b..2707bea 100644 --- a/src/pages/Liquidated.tsx +++ b/src/pages/Liquidated.tsx @@ -9,13 +9,11 @@ import { VaultStatesChart } from '@/widgets/VaultStatesChart'; import { populateMissingDays, subQueryFetcher } from '@/utils'; import { LIQUIDATIONS_DASHBOARD, VAULT_STATE_DAILIES_QUERY } from '@/queries'; import { GraphData, LiquidationDashboardResponse, VaultStateDailyResponse } from '@/types/liquidation-types'; -import { GRAPH_DAYS, SUBQUERY_STAGING_URL } from '@/constants'; +import { GRAPH_DAYS } from '@/constants'; import { ErrorAlert } from '@/components/ErrorAlert'; export function Liquidated() { - const { data, isLoading, error } = useSWR(LIQUIDATIONS_DASHBOARD, (query: string) => - subQueryFetcher(query), - ); + const { data, isLoading, error } = useSWR(LIQUIDATIONS_DASHBOARD, subQueryFetcher); const response: LiquidationDashboardResponse = data?.data?.data; const boardAuxes: { [key: string]: number } = response?.boardAuxes?.nodes?.reduce( @@ -28,28 +26,26 @@ export function Liquidated() { }; // Queries for graph - // const { - // data: vaultStateDailyData, - // isLoading: graphDataIsLoading, - // error: graphDataError, - // } = useSWR(VAULT_STATE_DAILIES_QUERY, (query: string) => - // subQueryFetcher(query, SUBQUERY_STAGING_URL), - // ); - // const vaultStateDailyResponse: VaultStateDailyResponse = vaultStateDailyData?.data?.data; - // const graphDataMap: { [key: number]: GraphData } = {}; - // vaultStateDailyResponse?.vaultStatesDailies.nodes?.forEach((vaultState) => { - // graphDataMap[Number(vaultState.id)] = { - // x: vaultState.blockTimeLast?.split('T')[0], - // key: Number(vaultState.id), - // active: Number(vaultState.active), - // liquidated: Number(vaultState.liquidated) + Number(vaultState.liquidatedClosed), - // closed: Number(vaultState.closed), - // }; - // }); + const { + data: vaultStateDailyData, + isLoading: graphDataIsLoading, + error: graphDataError, + } = useSWR(VAULT_STATE_DAILIES_QUERY, subQueryFetcher); + const vaultStateDailyResponse: VaultStateDailyResponse = vaultStateDailyData?.data?.data; + const graphDataMap: { [key: number]: GraphData } = {}; + vaultStateDailyResponse?.vaultStatesDailies.nodes?.forEach((vaultState) => { + graphDataMap[Number(vaultState.id)] = { + x: vaultState.blockTimeLast?.split('T')[0], + key: Number(vaultState.id), + active: Number(vaultState.active), + liquidated: Number(vaultState.liquidated) + Number(vaultState.liquidatedClosed), + closed: Number(vaultState.closed), + }; + }); - // const graphDataList = populateMissingDays(graphDataMap, GRAPH_DAYS); + const graphDataList = populateMissingDays(graphDataMap, GRAPH_DAYS); - const errorMessage = error; + const errorMessage = error || graphDataError; if (errorMessage) { return ; } @@ -61,7 +57,7 @@ export function Liquidated() { - {/* */} +
diff --git a/src/queries.ts b/src/queries.ts index 2386237..af28956 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -314,6 +314,8 @@ query { state balance blockTime + oraclePrice + vaultManagerGovernance currentState { id denom diff --git a/tests/__snapshots__/Liquidated.test.tsx.snap b/tests/__snapshots__/Liquidated.test.tsx.snap index d233d7c..e10e49a 100644 --- a/tests/__snapshots__/Liquidated.test.tsx.snap +++ b/tests/__snapshots__/Liquidated.test.tsx.snap @@ -36,6 +36,5947 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is +
+
+

+ Vault States +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 03/08 + + + + + + + + 03/09 + + + + + + + + 03/10 + + + + + + + + 03/11 + + + + + + + + 03/12 + + + + + + + + 03/13 + + + + + + + + 03/14 + + + + + + + + 03/15 + + + + + + + + 03/16 + + + + + + + + 03/17 + + + + + + + + 03/18 + + + + + + + + 03/19 + + + + + + + + 03/20 + + + + + + + + 03/21 + + + + + + + + 03/22 + + + + + + + + 03/23 + + + + + + + + 03/24 + + + + + + + + 03/25 + + + + + + + + 03/26 + + + + + + + + 03/27 + + + + + + + + 03/28 + + + + + + + + 03/29 + + + + + + + + 03/30 + + + + + + + + 03/31 + + + + + + + + 04/01 + + + + + + + + 04/02 + + + + + + + + 04/03 + + + + + + + + 04/04 + + + + + + + + 04/05 + + + + + + + + 04/06 + + + + + + + + 04/07 + + + + + + + + 04/08 + + + + + + + + 04/09 + + + + + + + + 04/10 + + + + + + + + 04/11 + + + + + + + + 04/12 + + + + + + + + 04/13 + + + + + + + + 04/14 + + + + + + + + 04/15 + + + + + + + + 04/16 + + + + + + + + 04/17 + + + + + + + + 04/18 + + + + + + + + 04/19 + + + + + + + + 04/20 + + + + + + + + 04/21 + + + + + + + + 04/22 + + + + + + + + 04/23 + + + + + + + + 04/24 + + + + + + + + 04/25 + + + + + + + + 04/26 + + + + + + + + 04/27 + + + + + + + + 04/28 + + + + + + + + 04/29 + + + + + + + + 04/30 + + + + + + + + 05/01 + + + + + + + + 05/02 + + + + + + + + 05/03 + + + + + + + + 05/04 + + + + + + + + 05/05 + + + + + + + + 05/06 + + + + + + + + 05/07 + + + + + + + + 05/08 + + + + + + + + 05/09 + + + + + + + + 05/10 + + + + + + + + 05/11 + + + + + + + + 05/12 + + + + + + + + 05/13 + + + + + + + + 05/14 + + + + + + + + 05/15 + + + + + + + + 05/16 + + + + + + + + 05/17 + + + + + + + + 05/18 + + + + + + + + 05/19 + + + + + + + + 05/20 + + + + + + + + 05/21 + + + + + + + + 05/22 + + + + + + + + 05/23 + + + + + + + + 05/24 + + + + + + + + 05/25 + + + + + + + + 05/26 + + + + + + + + 05/27 + + + + + + + + 05/28 + + + + + + + + 05/29 + + + + + + + + 05/30 + + + + + + + + 05/31 + + + + + + + + 06/01 + + + + + + + + 06/02 + + + + + + + + 06/03 + + + + + + + + 06/04 + + + + + + + + 06/05 + + + + + + + + + + + + + 0 + + + + + + + + 150 + + + + + + + + 300 + + + + + + + + 450 + + + + + + + + 600 + + + + + + + + + + + + + 0 + + + + + + + + 150 + + + + + + + + 300 + + + + + + + + 450 + + + + + + + + 600 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
    +
  • + + + + + + + Active + +
  • +
  • + + + + + + + Liquidated + +
  • +
  • + + + + + + + Closed + +
  • +
+
+ +
+
+
+

@@ -129,6 +6070,36 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is + + + + + + + + + + +
+ 230% +
+ + +
+ $8.72 +
+ @@ -196,6 +6200,15 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is 4.042 + +
+ $6.87 +
+ + +
+ 190% +
+ + +
+ $13.46 +
+ @@ -244,6 +6275,15 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is 3.749 + +
+ $4.61 +
+ + +
+ 200% +
+ + +
+ $26.03 +
+ @@ -292,6 +6350,15 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is 16.157 + +
+ $36.03 +
+ + +
+ 170% +
+ + +
+ $1.13 +
+ @@ -340,6 +6425,15 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is 0.001 + +
+ $0.00 +
+ + +
+ 100% +
+ + +
+ $4.92 +
+ @@ -388,6 +6500,15 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is 921.651 + +
+ $949.30 +
+ @@ -435,6 +6556,35 @@ exports[`Liquidation Dashboard Snapshot tests should match snapshot when data is +
+
+

+ Vault States +

+
+
+
+
+
+
+
+