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

feat: migrate positions table to abacus-ts #1375

Open
wants to merge 86 commits into
base: main
Choose a base branch
from

Conversation

tyleroooo
Copy link
Contributor

No description provided.

@tyleroooo tyleroooo requested a review from a team as a code owner December 17, 2024 21:19
Copy link

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 7:08pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 7:08pm

Comment on lines +86 to +87
const numTotalPositions = (useAppSelector(selectParentSubaccountOpenPositions) ?? EMPTY_ARR)
.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for now. but i feel like we get this num in multiple places. might be good to move to a hook

};
}, [position, stringGetter]);

return (
<TableCell
slotRight={
marginMode === AbacusMarginMode.Isolated && (
marginMode === 'ISOLATED' && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth adding MarginMode enums?

@@ -29,31 +27,33 @@ export const PositionsMarginCell = ({ position }: PositionsMarginCellProps) => {
const dispatch = useAppDispatch();

const { marginMode, margin } = useMemo(() => {
const { childSubaccountNumber } = position;
const derivedMarginMode = getMarginModeFromSubaccountNumber(childSubaccountNumber);
const { marginMode: marginModeInner, marginValueInitial } = position;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in love with the Inner suffix haha

Comment on lines +220 to +227
asset != null
? ({
id: asset.id,
name: asset.name,
tags: [],
resources: { imageUrl: asset.logo },
} as unknown as Asset)
: undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be updated w/ selectAllAssetsInfo -> selectAssetInfoFromId (new selector). Can probably call selector from <MarketTableCell marketId={...} />


const openPositions = useAppSelector(getExistingOpenPositions, shallowEqual) ?? EMPTY_ARR;
const perpetualMarkets = orEmptyRecord(useAppSelector(selectRawMarketsData));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use rawMarketsData instead of selectAllMarketsInfo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w/ rebase you'll be able to get assetId, tickSizeDecimals, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make sense to convert all values to bigNumber within calculateMarkets as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants