Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeirojose committed May 31, 2024
1 parent e57b344 commit b3796b7
Show file tree
Hide file tree
Showing 93 changed files with 534 additions and 534 deletions.
2 changes: 1 addition & 1 deletion apps/balancer-tools/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ module.exports = withSentryConfig(

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("calculateDepthCost for Gyro2", () => {

beforeAll(async () => {
const mockAmmPromise = await convertAnalysisDataToAMM(
mockAnalysisDataGyro2
mockAnalysisDataGyro2,
);
if (!mockAmmPromise)
throw new Error("Failed to convert mock analysis data to AMM");
Expand All @@ -55,7 +55,7 @@ describe("calculateDepthCost for Gyro2", () => {
"out",
mockAnalysisDataGyro2,
mockAmm,
mockAnalysisDataGyro2.poolType
mockAnalysisDataGyro2.poolType,
);

expect(result.type).toBe("price limit");
Expand All @@ -70,7 +70,7 @@ describe("calculateDepthCost for Gyro2", () => {
"in",
mockAnalysisDataGyro2,
mockAmm,
mockAnalysisDataGyro2.poolType
mockAnalysisDataGyro2.poolType,
);

expect(result.type).toBe("2% of price change");
Expand All @@ -94,7 +94,7 @@ describe("calculateDepthCost for MetaStable", () => {

beforeAll(async () => {
const mockAmmPromise = await convertAnalysisDataToAMM(
mockAnalysisDataMetaStable
mockAnalysisDataMetaStable,
);
if (!mockAmmPromise)
throw new Error("Failed to convert mock analysis data to AMM");
Expand All @@ -108,7 +108,7 @@ describe("calculateDepthCost for MetaStable", () => {
"in",
mockAnalysisDataMetaStable,
mockAmm,
mockAnalysisDataMetaStable.poolType
mockAnalysisDataMetaStable.poolType,
);

expect(result.type).toBe("2% of price change");
Expand Down
4 changes: 2 additions & 2 deletions apps/balancer-tools/src/app/apr/(components)/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function Breadcrumb() {
link={generatePoolPageLink(
parseMMDDYYYYToDate(searchParams.get("startAt")) as Date,
parseMMDDYYYYToDate(searchParams.get("endAt")) as Date,
{ network }
{ network },
)}
>
{network}
Expand All @@ -124,7 +124,7 @@ export default function Breadcrumb() {
<BreadcrumbItem
link={generatePoolPageLink(
parseMMDDYYYYToDate(searchParams.get("startAt")) as Date,
parseMMDDYYYYToDate(searchParams.get("endAt")) as Date
parseMMDDYYYYToDate(searchParams.get("endAt")) as Date,
)}
>
<div className="flex items-center gap-x-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default function HeaderEndButton() {
parseMMDDYYYYToDate(startAtParam as string) as Date,
parseMMDDYYYYToDate(endAtParam as string) as Date,
null,
poolId
)
poolId,
),
);
};
const avaliableNetworks = Object.keys(networksOnBalancer).map((key) => ({
Expand Down Expand Up @@ -77,7 +77,7 @@ export default function HeaderEndButton() {
} = values;
handleDateUpdate(
formatDateToMMDDYYYY(from),
formatDateToMMDDYYYY(to as Date)
formatDateToMMDDYYYY(to as Date),
);
}}
initialDateFrom={startAtParam ?? undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function MoreFiltersButton() {
}
return count;
}, 0),
[selectedAttributes]
[selectedAttributes],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function PoolListTable({
params.set("sort", accessor);
return params.toString();
},
[searchParams]
[searchParams],
);

const loadMorePools = async () => {
Expand Down Expand Up @@ -279,7 +279,7 @@ function APRHover({ apr }: { apr: APRwithoutBreakdown }) {

function OrderIcon(
searchParams: ReadonlyURLSearchParams,
fieldName: keyof PoolStats
fieldName: keyof PoolStats,
) {
if (searchParams.get("sort") !== fieldName) return <DashIcon />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { MultiSelectDropdown } from "./MultiSelectDropdown";
const AVALIABLE_TOKENS = [
...new Set(
POOLS_WITH_LIVE_GAUGES.flatMap((pool) =>
pool.tokens.map((token) => token.symbol)
)
pool.tokens.map((token) => token.symbol),
),
),
];

Expand Down
12 changes: 6 additions & 6 deletions apps/balancer-tools/src/app/apr/(components)/TopPoolsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ export default function TopPoolsChart({
result.tokens
.map(
(t) =>
`${t.symbol}${t.weight ? `-${(t.weight! * 100).toFixed()}%` : ""}`
`${t.symbol}${t.weight ? `-${(t.weight! * 100).toFixed()}%` : ""}`,
)
.join(" "),
`${result.apr.total.toFixed()}% APR`,
]);

const longestyAxisLabelLength = Math.max(
...yAxisLabels.map(
([tokenNames, aprLabel]) => tokenNames.length + aprLabel.length
)
([tokenNames, aprLabel]) => tokenNames.length + aprLabel.length,
),
);

const paddedYAxisLabels = yAxisLabels.map(([tokenNames, aprValue]) =>
[
tokenNames.padEnd(longestyAxisLabelLength - aprValue.length, " "),
aprValue,
].join(" ")
].join(" "),
);

const chartData: Data = {
Expand All @@ -65,7 +65,7 @@ export default function TopPoolsChart({
startAt,
endAt,
null,
clickedRoundData.poolId
clickedRoundData.poolId,
);
router.push(poolRedirectURL);
}
Expand All @@ -75,7 +75,7 @@ export default function TopPoolsChart({
<Plot
onClick={onClickHandler}
title={`Top APR Pools from ${formatDate(startAt)} to ${formatDate(
endAt
endAt,
)}`}
toolTip="Values are averaged for the given dates."
data={[chartData]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { and, between, eq, sql } from "drizzle-orm";
export async function fetchAvgDataForPoolIdDateRange(
poolId: string,
startDate: Date,
endDate: Date
endDate: Date,
) {
const yieldAprSum = db
.select({
poolExternalId: yieldTokenApr.poolExternalId,
timestamp: yieldTokenApr.timestamp,
yieldValueSum: sql<number>`sum(${yieldTokenApr.value})`.as(
"yieldValueSum"
"yieldValueSum",
),
})
.from(yieldTokenApr)
Expand All @@ -30,7 +30,7 @@ export async function fetchAvgDataForPoolIdDateRange(
poolExternalId: rewardsTokenApr.poolExternalId,
timestamp: rewardsTokenApr.timestamp,
rewardValueSum: sql<number>`sum(${rewardsTokenApr.value})`.as(
"rewardValueSum"
"rewardValueSum",
),
})
.from(rewardsTokenApr)
Expand All @@ -41,47 +41,47 @@ export async function fetchAvgDataForPoolIdDateRange(
poolExternalId: poolSnapshots.poolExternalId,
avgApr:
sql<number>`cast(sum(coalesce(${swapFeeApr.value},0) + coalesce(${vebalApr.value},0) + coalesce(${yieldAprSum.yieldValueSum},0) + coalesce(${rewardAprSum.rewardValueSum},0)) / count(${poolSnapshots.timestamp}) as decimal)`.as(
"avgApr"
"avgApr",
),
avgLiquidity:
sql<number>`cast(sum(${poolSnapshots.liquidity}) / count(${poolSnapshots.timestamp}) as decimal)`.as(
"avgLiquidity"
"avgLiquidity",
),
})
.from(poolSnapshots)
.fullJoin(
swapFeeApr,
and(
eq(poolSnapshots.poolExternalId, swapFeeApr.poolExternalId),
eq(poolSnapshots.timestamp, swapFeeApr.timestamp)
)
eq(poolSnapshots.timestamp, swapFeeApr.timestamp),
),
)
.fullJoin(
vebalApr,
and(
eq(vebalApr.poolExternalId, poolSnapshots.poolExternalId),
eq(vebalApr.timestamp, poolSnapshots.timestamp)
)
eq(vebalApr.timestamp, poolSnapshots.timestamp),
),
)
.fullJoin(
yieldAprSum,
and(
eq(yieldAprSum.poolExternalId, poolSnapshots.poolExternalId),
eq(yieldAprSum.timestamp, poolSnapshots.timestamp)
)
eq(yieldAprSum.timestamp, poolSnapshots.timestamp),
),
)
.fullJoin(
rewardAprSum,
and(
eq(rewardAprSum.poolExternalId, poolSnapshots.poolExternalId),
eq(rewardAprSum.timestamp, poolSnapshots.timestamp)
)
eq(rewardAprSum.timestamp, poolSnapshots.timestamp),
),
)
.where(
and(
between(poolSnapshots.timestamp, startDate, endDate),
eq(poolSnapshots.poolExternalId, poolId)
)
eq(poolSnapshots.poolExternalId, poolId),
),
)
.groupBy(poolSnapshots.poolExternalId);

Expand Down
Loading

0 comments on commit b3796b7

Please sign in to comment.