Skip to content

Commit

Permalink
Merge pull request #1590 from bancorprotocol/issue-#1589
Browse files Browse the repository at this point in the history
Find all strategies from one token
  • Loading branch information
GrandSchtroumpf authored Dec 16, 2024
2 parents 27bb2d7 + 4b97255 commit c6633d4
Show file tree
Hide file tree
Showing 133 changed files with 765 additions and 378 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_limit/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/simulator/recurring/Recurring_range_range/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/create/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/deposit/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/undercut/form.png
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/withdraw/form.png
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<meta name="twitter:title" content="Carbon DeFi - Automated trading strategies">
<meta name="twitter:description" content="Carbon DeFi is an advanced onchain trading protocol enabling automated limit orders, efficiently adjustable w/ custom price ranges, grid trading like recurring orders, works like a DEX trading bot.">
<meta name="twitter:image" content="https://framerusercontent.com/images/7YeuJPKg50bkh0m7b1yRwhCNIoE.png">

<!-- Preload fonts that are the most likely to be used quickly -->
<link rel="preload" href="assets/font/title/medium.woff2" as="font" type="font/woff2"/>
<link rel="preload" href="assets/font/text/medium.woff2" as="font" type="font/woff2"/>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@babel/core": "^7.0.0-0",
"@bancor/carbon-sdk": "0.0.99-DEV",
"@bancor/carbon-sdk": "0.0.103-DEV",
"@cloudflare/workers-types": "^4.20230717.0",
"@ethersproject/abi": "^5.0.0",
"@ethersproject/bytes": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const App = () => {
<>
<NotificationAlerts />
<MainMenu />
<main className="mb-16 mt-80 grid flex-grow">
<main className="mb-16 grid flex-grow">
<MainContent />
</main>
<Footer />
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity/useActivityQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const useActivityQuery = (
params: QueryActivityParams = {},
config: ActivityQueryConfig = {}
) => {
const { tokensMap, isPending, importToken } = useTokens();
const { tokensMap, isPending, importTokens } = useTokens();
const { Token } = useContract();
const validParams = isValidParams(params);

Expand All @@ -100,7 +100,7 @@ export const useActivityQuery = (
return fetchTokenData(Token, address);
});
const tokens = await Promise.all(getTokens);
tokens.forEach((data) => importToken(data));
importTokens(tokens);
};

return useQuery({
Expand Down
34 changes: 29 additions & 5 deletions src/components/common/PairLogoName.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
import { TokensOverlap } from 'components/common/tokensOverlap';
import { WarningWithTooltip } from 'components/common/WarningWithTooltip/WarningWithTooltip';
import { TradePair } from 'libs/modals/modals/ModalTradeTokenList';
import { FC } from 'react';
import { Token } from 'libs/tokens';
import { FC, memo } from 'react';
import { TokenLogo } from './imager/Imager';

const suspiciousTokenTooltipMsg =
'This token is not part of any known token list. Always conduct your own research before trading.';

interface Props {
interface TokenProps {
token: Token;
}
export const _TokenLogoName: FC<TokenProps> = ({ token }) => {
return (
<>
<TokenLogo token={token} size={30} />
{token.symbol}
{token.isSuspicious && (
<WarningWithTooltip tooltipContent={suspiciousTokenTooltipMsg} />
)}
</>
);
};
export const TokenLogoName = memo(_TokenLogoName, (a, b) => {
return a.token.address === b.token.address;
});

interface PairProps {
pair: TradePair;
}

export const PairLogoName: FC<Props> = ({
pair: { baseToken, quoteToken },
}) => {
const _PairLogoName: FC<PairProps> = ({ pair: { baseToken, quoteToken } }) => {
return (
<>
<TokensOverlap tokens={[baseToken, quoteToken]} size={30} />
Expand All @@ -30,3 +48,9 @@ export const PairLogoName: FC<Props> = ({
</>
);
};
export const PairLogoName = memo(_PairLogoName, (a, b) => {
return (
a.pair.baseToken.address === b.pair.baseToken.address &&
a.pair.quoteToken.address === b.pair.quoteToken.address
);
});
2 changes: 1 addition & 1 deletion src/components/common/Toaster/Toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Toaster: FC = () => {
return (
<ul
id="toaster"
className="fixed bottom-16 right-16 z-10 flex min-w-[250px] flex-col gap-8"
className="fixed bottom-16 right-24 z-10 flex min-w-[250px] flex-col gap-8"
>
{toaster.toasts.map((toast) => (
<ToastItem key={toast.id} {...toast} />
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/imager/Imager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const Imager = ({
...props
}: ImageProps) => {
const { source } = useImager(src, fallbackSrc);

return (
<img
{...props}
Expand All @@ -90,7 +89,7 @@ export const TokenLogo = ({ token, size, className }: TokenLogoProps) => {
src={token.logoURI}
alt={token.name ?? token.symbol}
title={token.symbol}
className={className}
className={cn(className, 'border border-black bg-black')}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/core/menu/mainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MainMenuRight } from 'components/core/menu/mainMenu/MainMenuRight';

export const MainMenu: FC = () => {
return (
<header className="fixed top-0 z-40 w-full" data-testid="main-menu">
<header className="sticky top-0 z-40 w-full" data-testid="main-menu">
<div className="main-menu">
<MainMenuLeft />
<MainMenuRight />
Expand Down
8 changes: 4 additions & 4 deletions src/components/debug/DebugTransferNFT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from 'components/common/button';
import { Input, InputUserAccount, Label } from 'components/common/inputField';
import { useWagmi } from 'libs/wagmi';
import { QueryKey, useQueryClient } from 'libs/queries';
import { useContract } from 'hooks/useContract';
import { useVoucher } from 'hooks/useContract';

export const DebugTransferNFT = () => {
const { user } = useWagmi();
Expand All @@ -13,7 +13,7 @@ export const DebugTransferNFT = () => {
const [isSuccess, setIsSuccess] = useState(false);
const [isError, setIsError] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const { Voucher } = useContract();
const { data: Voucher } = useVoucher();

const handleOnClick = async () => {
setIsSuccess(false);
Expand All @@ -25,12 +25,12 @@ export const DebugTransferNFT = () => {
setIsLoading(true);

try {
const tx = await Voucher.write.transferFrom(
const tx = await Voucher?.write.transferFrom(
user,
inputRecipient,
inputId
);
await tx.wait();
await tx?.wait();
await cache.invalidateQueries({ queryKey: QueryKey.strategies(user) });
setIsSuccess(true);
} catch (e) {
Expand Down
11 changes: 1 addition & 10 deletions src/components/explorer/ExplorerSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ export const _ExplorerSearch: FC = () => {
setSearch,
};

const suggestionProps = {
pairMap: pairs.map,
nameMap: pairs.names,
search,
setSearch,
};

return (
<div className="relative">
<form
Expand Down Expand Up @@ -136,9 +129,7 @@ export const _ExplorerSearch: FC = () => {
</div>
<div role="separator" className="h-20 w-1 bg-white/40"></div>
<div className="flex w-full flex-grow items-center md:relative">
{type === 'token-pair' && (
<ExplorerSearchSuggestions {...suggestionProps} />
)}
{type === 'token-pair' && <ExplorerSearchSuggestions />}
{type === 'wallet' && <ExplorerSearchInput {...inputProps} />}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/explorer/ExplorerSearchDropdownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const ExplorerSearchDropdownButton = forwardRef<
{type === 'token-pair' && (
<>
<IconTokenPair className="size-18 text-primary" />
<span className="hidden md:inline">Token Pair</span>
<span className="hidden md:inline">Token / Pair</span>
</>
)}
<IconChevron className="size-16 text-white/40" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/explorer/ExplorerSearchDropdownItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ExplorerSearchDropdownItems: FC<Props> = ({ setSearch }) => {
},
{
type: 'token-pair' as const,
label: 'Token Pair',
label: 'Token / Pair',
active: currentType === 'token-pair',
},
];
Expand All @@ -36,7 +36,7 @@ export const ExplorerSearchDropdownItems: FC<Props> = ({ setSearch }) => {
active && 'flex items-center justify-between'
)}
>
<span> {label}</span>
<span>{label}</span>
<IconCheck className={cn('w-14', !active && 'hidden')} />
</Link>
))}
Expand Down
Loading

0 comments on commit c6633d4

Please sign in to comment.