Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling refs/heads/staging into test-staging #2440

Merged
merged 5 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions components/assets/AssetActionButtons/AssetTradingButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,15 @@ const AssetTradingButtons = ({
{tradeItem && (
<Modal open={isOpen} onClose={() => setIsOpen(false)}>
<Dialog.Panel className="w-full max-w-[564px] rounded-[10px] bg-white">
{market?.scoringRule === ScoringRule.AmmCdaHybrid ? (
<Amm2TradeForm
marketId={marketId}
initialAsset={assetId}
selectedTab={
tradeItem.action === "buy"
? TradeTabType.Buy
: TradeTabType.Sell
}
/>
) : (
<TradeForm />
)}
<Amm2TradeForm
marketId={marketId}
initialAsset={assetId}
selectedTab={
tradeItem.action === "buy"
? TradeTabType.Buy
: TradeTabType.Sell
}
/>
</Dialog.Panel>
</Modal>
)}
Expand Down
5 changes: 1 addition & 4 deletions components/liquidity/MarketLiquiditySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ export const MarketLiquiditySection = ({
market: FullMarketFragment;
poll?: boolean;
}) => {
const marketHasPool =
(market?.scoringRule === ScoringRule.Cpmm && market.pool != null) ||
(market?.scoringRule === ScoringRule.AmmCdaHybrid &&
market.neoPool != null);
const marketHasPool = market.neoPool != null;

return (
<>
Expand Down
1 change: 0 additions & 1 deletion lib/gql/trending-markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const getTrendingMarkets = async (
order: MarketOrderByInput.IdDesc,
where: {
status_eq: MarketStatus.Active,
scoringRule_eq: ScoringRule.AmmCdaHybrid,
...marketMetaFilter,
},
});
Expand Down
4 changes: 4 additions & 0 deletions lib/hooks/queries/useInfiniteMarkets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export const useInfiniteMarkets = (
scoringRule_eq: ScoringRule.AmmCdaHybrid,
neoPool_isNull: withLiquidityOnly ? false : undefined,
},
{
scoringRule_eq: ScoringRule.Lmsr,
neoPool_isNull: withLiquidityOnly ? false : undefined,
},
],
},
],
Expand Down
3 changes: 2 additions & 1 deletion lib/hooks/queries/useMarketSpotPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const useMarketSpotPrices = (
if (!enabled) return;
const spotPrices: MarketPrices =
market?.status !== "Resolved"
? market.scoringRule === ScoringRule.AmmCdaHybrid
? market.scoringRule === ScoringRule.AmmCdaHybrid ||
market.scoringRule === ScoringRule.Lmsr
? calcMarketPricesAmm2(amm2Pool!)
: calcMarketPrices(market, basePoolBalance!, balances!)
: calcResolvedMarketPrices(market);
Expand Down
11 changes: 9 additions & 2 deletions lib/hooks/queries/usePortfolioPositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ export const usePortfolioPositions = (
const pools = usePoolsByIds(filter);
const markets = useMarketsByIds(filter);
const amm2MarketIds = markets.data
?.filter((market) => market.scoringRule === ScoringRule.AmmCdaHybrid)
?.filter(
(market) =>
market.scoringRule === ScoringRule.AmmCdaHybrid ||
market.scoringRule === ScoringRule.Lmsr,
)
.map((m) => m.marketId);

const { data: amm2SpotPrices } = useAmm2MarketSpotPrices(amm2MarketIds);
Expand Down Expand Up @@ -318,7 +322,10 @@ export const usePortfolioPositions = (
price = calcResolvedMarketPrices(market).get(getIndexOf(assetId));
price24HoursAgo = price;
} else {
if (market.scoringRule === ScoringRule.AmmCdaHybrid) {
if (
market.scoringRule === ScoringRule.AmmCdaHybrid ||
market.scoringRule === ScoringRule.Lmsr
) {
price = lookupAssetPrice(assetId, amm2SpotPrices);

price24HoursAgo = lookupAssetPrice(
Expand Down
3 changes: 2 additions & 1 deletion lib/util/calc-resolved-market-prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const calcResolvedMarketPrices = (
market: FullMarketFragment,
): MarketPrices => {
const assetIds = (
market.scoringRule === ScoringRule.AmmCdaHybrid
market.scoringRule === ScoringRule.AmmCdaHybrid ||
market.scoringRule === ScoringRule.Lmsr
? market.neoPool?.account.balances.map((b) =>
parseAssetIdString(b.assetId),
)
Expand Down
9 changes: 2 additions & 7 deletions pages/markets/[marketid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,7 @@ const Market: NextPage<MarketPageProps> = ({
const hasLiveTwitchStream =
hasLiveTwitchStreamClient || hasLiveTwitchStreamServer;

const marketHasPool =
(market?.scoringRule === ScoringRule.Cpmm &&
poolId != null &&
poolIdLoading === false) ||
(market?.scoringRule === ScoringRule.AmmCdaHybrid &&
market.neoPool != null);
const marketHasPool = market?.neoPool != null;

const poolCreationDate = new Date(
indexedMarket.pool?.createdAt ?? indexedMarket.neoPool?.createdAt ?? "",
Expand Down Expand Up @@ -396,7 +391,7 @@ const Market: NextPage<MarketPageProps> = ({

<Tab
key="twitch"
className="flex items-center gap-2 rounded-md border-1 border-twitch-purple px-2 py-1 text-twitch-purple ui-selected:border-transparent ui-selected:bg-twitch-purple ui-selected:text-twitch-gray"
className="border-twitch-purple text-twitch-purple ui-selected:bg-twitch-purple ui-selected:text-twitch-gray flex items-center gap-2 rounded-md border-1 px-2 py-1 ui-selected:border-transparent"
>
<FaTwitch size={16} />
Twitch Stream
Expand Down
Loading