Skip to content

Commit d54d855

Browse files
committed
Resolve comments
1 parent 9a32a10 commit d54d855

File tree

17 files changed

+356
-249
lines changed

17 files changed

+356
-249
lines changed

docs/whirlpool/docusaurus.config.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { themes } from "prism-react-renderer";
2-
import remarkMath from 'remark-math';
3-
import rehypeKatex from 'rehype-katex';
2+
import remarkMath from "remark-math";
3+
import rehypeKatex from "rehype-katex";
44

55
export default {
66
title: "Whirlpools",
@@ -30,9 +30,10 @@ export default {
3030
docs: {
3131
routeBasePath: "/",
3232
sidebarPath: "./sidebars.js",
33-
editUrl: "https://github.com/orca-so/whirlpools/tree/main/docs/whirlpool",
33+
editUrl:
34+
"https://github.com/orca-so/whirlpools/tree/main/docs/whirlpool",
3435
remarkPlugins: [remarkMath],
35-
rehypePlugins: [rehypeKatex]
36+
rehypePlugins: [rehypeKatex],
3637
},
3738
theme: {
3839
customCss: "./static/index.css",
@@ -43,11 +44,11 @@ export default {
4344

4445
stylesheets: [
4546
{
46-
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
47-
type: 'text/css',
47+
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
48+
type: "text/css",
4849
integrity:
49-
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
50-
crossorigin: 'anonymous',
50+
"sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",
51+
crossorigin: "anonymous",
5152
},
5253
],
5354

docs/whirlpool/src/theme/DocCard/index.js

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,64 @@
1-
import React from 'react';
2-
import clsx from 'clsx';
3-
import Link from '@docusaurus/Link';
1+
import React from "react";
2+
import clsx from "clsx";
3+
import Link from "@docusaurus/Link";
44
import {
55
useDocById,
66
findFirstSidebarItemLink,
7-
} from '@docusaurus/plugin-content-docs/client';
8-
import {usePluralForm} from '@docusaurus/theme-common';
9-
import isInternalUrl from '@docusaurus/isInternalUrl';
10-
import {translate} from '@docusaurus/Translate';
11-
import Heading from '@theme/Heading';
12-
import styles from './styles.module.css';
7+
} from "@docusaurus/plugin-content-docs/client";
8+
import { usePluralForm } from "@docusaurus/theme-common";
9+
import isInternalUrl from "@docusaurus/isInternalUrl";
10+
import { translate } from "@docusaurus/Translate";
11+
import Heading from "@theme/Heading";
12+
import styles from "./styles.module.css";
1313

1414
function useCategoryItemsPlural() {
15-
const {selectMessage} = usePluralForm();
15+
const { selectMessage } = usePluralForm();
1616
return (count) =>
1717
selectMessage(
1818
count,
1919
translate(
2020
{
21-
message: '1 item|{count} items',
22-
id: 'theme.docs.DocCard.categoryDescription.plurals',
21+
message: "1 item|{count} items",
22+
id: "theme.docs.DocCard.categoryDescription.plurals",
2323
description:
24-
'The default description for a category card in the generated index about how many items this category includes',
24+
"The default description for a category card in the generated index about how many items this category includes",
2525
},
26-
{count},
26+
{ count },
2727
),
2828
);
2929
}
30-
function CardContainer({href, children}) {
30+
function CardContainer({ href, children }) {
3131
return (
3232
<Link
3333
href={href}
34-
className={clsx('card padding--lg', styles.cardContainer)}>
34+
className={clsx("card padding--lg", styles.cardContainer)}
35+
>
3536
{children}
3637
</Link>
3738
);
3839
}
39-
function CardLayout({href, icon, title, description}) {
40+
function CardLayout({ href, icon, title, description }) {
4041
return (
4142
<CardContainer href={href}>
4243
<Heading
4344
as="h2"
44-
className={clsx('text--truncate', styles.cardTitle)}
45-
title={title}>
45+
className={clsx("text--truncate", styles.cardTitle)}
46+
title={title}
47+
>
4648
{icon} {title}
4749
</Heading>
4850
{description && (
4951
<p
50-
className={clsx('text--truncate', styles.cardDescription)}
51-
title={description}>
52+
className={clsx("text--truncate", styles.cardDescription)}
53+
title={description}
54+
>
5255
{description}
5356
</p>
5457
)}
5558
</CardContainer>
5659
);
5760
}
58-
function CardCategory({item}) {
61+
function CardCategory({ item }) {
5962
const href = findFirstSidebarItemLink(item);
6063
const categoryItemsPlural = useCategoryItemsPlural();
6164
// Unexpected: categories that don't have a link have been filtered upfront
@@ -71,8 +74,8 @@ function CardCategory({item}) {
7174
/>
7275
);
7376
}
74-
function CardLink({item}) {
75-
const icon = isInternalUrl(item.href) ? '📄️' : '🔗';
77+
function CardLink({ item }) {
78+
const icon = isInternalUrl(item.href) ? "📄️" : "🔗";
7679
const doc = useDocById(item.docId ?? undefined);
7780
return (
7881
<CardLayout
@@ -83,11 +86,11 @@ function CardLink({item}) {
8386
/>
8487
);
8588
}
86-
export default function DocCard({item}) {
89+
export default function DocCard({ item }) {
8790
switch (item.type) {
88-
case 'link':
91+
case "link":
8992
return <CardLink item={item} />;
90-
case 'category':
93+
case "category":
9194
return <CardCategory item={item} />;
9295
default:
9396
throw new Error(`unknown item type ${JSON.stringify(item)}`);

legacy-sdk/whirlpool/src/types/public/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const ORCA_WHIRLPOOLS_CONFIG = new PublicKey(
2222
* @category Constants
2323
*/
2424
export const ORCA_WHIRLPOOLS_CONFIG_ECLIPSE = new PublicKey(
25-
"FVG4oDbGv16hqTUbovjyGmtYikn6UBEnazz6RVDMEFwv",
25+
"FVG4oDbGv16hqTUbovjyGmtYikn6UBEnazz6RVDMEFwv",
2626
);
2727

2828
/**

programs/whirlpool/src/instructions/open_position_with_token_extensions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub fn handler(
8484

8585
if with_token_metadata {
8686
let (name, symbol, uri) = build_position_token_metadata(position_mint, position, whirlpool);
87-
87+
8888
initialize_token_metadata_extension(
8989
name,
9090
symbol,

programs/whirlpool/src/math/token_math.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::errors::ErrorCode;
2-
use crate::math::{Q64_RESOLUTION, Q64_MASK};
2+
use crate::math::{Q64_MASK, Q64_RESOLUTION};
33

44
use super::{
5-
div_round_up_if, div_round_up_if_u256, mul_u256,
6-
U256Muldiv, MAX_SQRT_PRICE_X64, MIN_SQRT_PRICE_X64,
5+
div_round_up_if, div_round_up_if_u256, mul_u256, U256Muldiv, MAX_SQRT_PRICE_X64,
6+
MIN_SQRT_PRICE_X64,
77
};
88

99
// Fee rate is represented as hundredths of a basis point.
@@ -110,14 +110,13 @@ pub fn try_get_amount_delta_a(
110110
if result > u64::MAX as u128 {
111111
return Ok(AmountDeltaU64::ExceedsMax(ErrorCode::TokenMaxExceeded));
112112
}
113-
114-
Ok(AmountDeltaU64::Valid(result as u64))
115-
},
113+
114+
Ok(AmountDeltaU64::Valid(result as u64))
115+
}
116116
Err(err) => Ok(AmountDeltaU64::ExceedsMax(err)),
117117
}
118118
}
119119

120-
121120
//
122121
// Get change in token_b corresponding to a change in price
123122
//
@@ -162,12 +161,20 @@ pub fn try_get_amount_delta_b(
162161

163162
let should_round = round_up && (p & Q64_MASK > 0);
164163
if should_round && result == u64::MAX {
165-
return Ok(AmountDeltaU64::ExceedsMax(ErrorCode::MultiplicationOverflow));
164+
return Ok(AmountDeltaU64::ExceedsMax(
165+
ErrorCode::MultiplicationOverflow,
166+
));
166167
}
167-
168-
Ok(AmountDeltaU64::Valid(if should_round { result + 1 } else { result }))
168+
169+
Ok(AmountDeltaU64::Valid(if should_round {
170+
result + 1
171+
} else {
172+
result
173+
}))
169174
} else {
170-
Ok(AmountDeltaU64::ExceedsMax(ErrorCode::MultiplicationShiftRightOverflow))
175+
Ok(AmountDeltaU64::ExceedsMax(
176+
ErrorCode::MultiplicationShiftRightOverflow,
177+
))
171178
}
172179
}
173180

0 commit comments

Comments
 (0)