Skip to content

Commit

Permalink
Revert "Fix all bridges daily chart"
Browse files Browse the repository at this point in the history
This reverts commit 0a38a9a.
  • Loading branch information
vrtnd committed Jul 23, 2023
1 parent 0a38a9a commit 7e4ba86
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/utils/bridgeVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getDailyBridgeVolume = async (
) => {
let bridgeDbName = undefined as any;
if (bridgeNetworkId) {
const bridgeNetwork = importBridgeNetwork(undefined, bridgeNetworkId);
const bridgeNetwork = importBridgeNetwork(undefined, bridgeNetworkId)
if (!bridgeNetwork) {
throw new Error("Invalid bridgeNetworkId entered for getting daily bridge volume.");
}
Expand Down Expand Up @@ -117,14 +117,15 @@ export const getDailyBridgeVolume = async (
*/

let historicalDailySums = {} as { [timestamp: string]: any };
historicalDailyData.map((dailyData: any) => {
historicalDailyData.map((dailyData) => {
const { bridge_id, ts, total_deposited_usd, total_withdrawn_usd, total_deposit_txs, total_withdrawal_txs } =
dailyData;
const timestamp = convertToUnixTimestamp(ts);
historicalDailySums[timestamp] = historicalDailySums[timestamp] || {};
historicalDailySums[timestamp].depositUSD = (historicalDailySums[timestamp].depositUSD ?? 0) + total_deposited_usd;
historicalDailySums[timestamp].depositUSD =
(historicalDailySums[timestamp].depositUSD ?? 0) + parseFloat(total_deposited_usd);
historicalDailySums[timestamp].withdrawUSD =
(historicalDailySums[timestamp].withdrawUSD ?? 0) + total_withdrawn_usd;
(historicalDailySums[timestamp].withdrawUSD ?? 0) + parseFloat(total_withdrawn_usd);
historicalDailySums[timestamp].depositTxs = (historicalDailySums[timestamp].depositTxs ?? 0) + total_deposit_txs;
historicalDailySums[timestamp].withdrawTxs =
(historicalDailySums[timestamp].withdrawTxs ?? 0) + total_withdrawal_txs;
Expand All @@ -133,9 +134,9 @@ export const getDailyBridgeVolume = async (
if (!chain && chainIdsWithSingleEntry.includes(bridge_id)) {
historicalDailySums[timestamp] = historicalDailySums[timestamp] || {};
historicalDailySums[timestamp].depositUSD =
(historicalDailySums[timestamp].depositUSD ?? 0) + total_withdrawn_usd;
(historicalDailySums[timestamp].depositUSD ?? 0) + parseFloat(total_withdrawn_usd);
historicalDailySums[timestamp].withdrawUSD =
(historicalDailySums[timestamp].withdrawUSD ?? 0) + total_deposited_usd;
(historicalDailySums[timestamp].withdrawUSD ?? 0) + parseFloat(total_deposited_usd);
historicalDailySums[timestamp].depositTxs =
(historicalDailySums[timestamp].depositTxs ?? 0) + total_withdrawal_txs;
historicalDailySums[timestamp].withdrawTxs =
Expand All @@ -147,9 +148,10 @@ export const getDailyBridgeVolume = async (
const { ts, total_deposited_usd, total_withdrawn_usd, total_deposit_txs, total_withdrawal_txs } = dailyData;
const timestamp = convertToUnixTimestamp(ts);
historicalDailySums[timestamp] = historicalDailySums[timestamp] || {};
historicalDailySums[timestamp].depositUSD = (historicalDailySums[timestamp].depositUSD ?? 0) + total_withdrawn_usd;
historicalDailySums[timestamp].depositUSD =
(historicalDailySums[timestamp].depositUSD ?? 0) + parseFloat(total_withdrawn_usd);
historicalDailySums[timestamp].withdrawUSD =
(historicalDailySums[timestamp].withdrawUSD ?? 0) + total_deposited_usd;
(historicalDailySums[timestamp].withdrawUSD ?? 0) + parseFloat(total_deposited_usd);
historicalDailySums[timestamp].depositTxs = (historicalDailySums[timestamp].depositTxs ?? 0) + total_withdrawal_txs;
historicalDailySums[timestamp].withdrawTxs = (historicalDailySums[timestamp].withdrawTxs ?? 0) + total_deposit_txs;
});
Expand Down Expand Up @@ -237,7 +239,7 @@ export const getHourlyBridgeVolume = async (
) => {
let bridgeDbName = undefined as any;
if (bridgeNetworkId) {
const bridgeNetwork = importBridgeNetwork(undefined, bridgeNetworkId);
const bridgeNetwork = importBridgeNetwork(undefined, bridgeNetworkId)
if (!bridgeNetwork) {
throw new Error("Invalid bridgeNetworkId entered for getting daily bridge volume.");
}
Expand Down Expand Up @@ -275,7 +277,7 @@ export const getHourlyBridgeVolume = async (
chain,
bridgeDbName
);

let historicalHourlySums = {} as { [timestamp: string]: any };
historicalHourlyData.map((hourlyData) => {
const { bridge_id, ts, total_deposited_usd, total_withdrawn_usd, total_deposit_txs, total_withdrawal_txs } =
Expand Down

0 comments on commit 7e4ba86

Please sign in to comment.