Skip to content

Commit

Permalink
Release 2022-11-30 (#2458)
Browse files Browse the repository at this point in the history
* Hide XUSD_legacy from margin trade (#2446)

* Fix RBTC missing on Swap page (#2447)

* Remove Perpetuals page from navigation (#2456)

Co-authored-by: tiltom <[email protected]>
  • Loading branch information
soulBit and tiltom authored Nov 30, 2022
1 parent ab8c134 commit 252a15c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 74 deletions.
20 changes: 2 additions & 18 deletions src/app/components/NetworkRibbon/NetworkRibbon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import { DetectionScreen } from './component/DetectionScreen';
import { TutorialScreen } from './component/TutorialScreen';
import { selectWalletProvider } from '../../containers/WalletProvider/selectors';
import { getNetworkByChainId } from '../../../utils/blockchain/networks';
import { isMainnet } from 'utils/classifiers';
import { ChainId } from 'types';

const showPerps = !isMainnet;

export function NetworkRibbon(this: any) {
const { bridgeChainId } = useSelector(selectWalletProvider);
Expand All @@ -30,8 +26,7 @@ export function NetworkRibbon(this: any) {
if (
!connected ||
!isWeb3Wallet(wallet.providerType!) ||
location.pathname.startsWith('/cross-chain') ||
(!showPerps && location.pathname.startsWith('/perpetuals'))
location.pathname.startsWith('/cross-chain')
) {
return false;
}
Expand All @@ -40,7 +35,7 @@ export function NetworkRibbon(this: any) {
return chainId !== bridgeChainId;
}

return chainId !== getExpectedChainId(expectedChainId, location.pathname);
return chainId !== expectedChainId;
}, [
bridgeChainId,
location.pathname,
Expand Down Expand Up @@ -90,14 +85,3 @@ export function NetworkRibbon(this: any) {
</NetworkDialog>
);
}

const getExpectedChainId = (
expectedChainId: number | undefined,
pathname: string,
) => {
if (pathname.startsWith('/perpetuals') && showPerps) {
return isMainnet ? ChainId.BSC_MAINNET : ChainId.BSC_TESTNET;
}

return expectedChainId;
};
10 changes: 0 additions & 10 deletions src/app/containers/PageContainer/PageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ import {
} from './types';
import { DefaultHeaderComponent } from './components/DefaultHeaderComponent/DefaultHeaderComponent';
import { Footer } from './components/DefaultFooterComponent/DefaultFooterComponent';
import { isMainnet } from 'utils/classifiers';

type HeaderContainerProps = {
pageOptions: PageOptions;
};

const showPerps = !isMainnet;

export const PageContainer: React.FC<Partial<HeaderContainerProps>> = ({
children,
pageOptions,
Expand All @@ -47,11 +44,6 @@ export const PageContainer: React.FC<Partial<HeaderContainerProps>> = ({
} else if (pathname.startsWith('/cross-chain')) {
initialOptions.header = HeaderTypes.CROSS_CHAIN;
initialOptions.footer = FooterTypes.NONE;
} else if (pathname.startsWith('/perpetuals')) {
initialOptions.header = HeaderTypes.LABS;
initialOptions.footer = showPerps
? FooterTypes.PERPETUALS
: FooterTypes.NONE;
} else {
initialOptions.header = HeaderTypes.DEFAULT;
initialOptions.footer = FooterTypes.DEFAULT;
Expand Down Expand Up @@ -86,8 +78,6 @@ export const PageContainer: React.FC<Partial<HeaderContainerProps>> = ({
switch (options.footer) {
case FooterTypes.DEFAULT:
return <Footer {...options.footerProps} />;
case FooterTypes.PERPETUALS:
return <Footer isPerpetuals />;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ type PagesProps = {
hrefExternal?: boolean;
};

// TODO: Delete this once we go live, we may need it after the competition
const showPerps = true; // !isMainnet || isStaging;

const showZero = isMainnet || isStaging;

export const DefaultHeaderComponent: React.FC = () => {
Expand Down Expand Up @@ -131,13 +128,6 @@ export const DefaultHeaderComponent: React.FC = () => {
hrefExternal: true,
});
}
if (showPerps) {
labPages.push({
to: '/perpetuals',
title: t(translations.mainMenu.perpetuals),
dataActionId: 'header-mobile-lab-link-perpetuals',
});
}

const pages: PagesProps[] = [
{
Expand Down Expand Up @@ -293,7 +283,6 @@ export const DefaultHeaderComponent: React.FC = () => {
'/labs',
'/zero',
'/mynt-token',
'/perpetuals',
],
[SECTION_TYPE.BORROW]: ['/borrow'],
};
Expand Down Expand Up @@ -466,13 +455,6 @@ export const DefaultHeaderComponent: React.FC = () => {
dataActionId="header-lab-link-zero"
/>
)}
<MenuItem
text={t(translations.mainMenu.perpetuals)}
label={t(translations.mainMenu.labels.perpetuals)}
href="/perpetuals"
disabled={!showPerps}
dataActionId="header-lab-link-perpetuals"
/>
</>
}
>
Expand Down
2 changes: 0 additions & 2 deletions src/app/containers/PageContainer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ export enum HeaderTypes {
FAST_BTC,
CROSS_CHAIN,
LABS,
PERPETUALS,
}

export enum FooterTypes {
NONE,
DEFAULT,
PERPETUALS,
}

export type PageContextState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ export const SwapSelector: React.FC<ISwapSelectorProps> = ({
return null;
}

//as we don't have RBTC as source, we make a separate reverted pair from USDT_RBTC
//as we don't have RBTC as source, we make a separate reverted pair from XUSD_RBTC
let pairDivRBTC;
let pairDiv;

//show RBTC asset and make it searchable
if (
assetDetails.asset === Asset.USDT &&
assetDetails.asset === Asset.XUSD &&
Asset.RBTC.includes(search.toUpperCase())
)
pairDivRBTC = (
Expand Down
14 changes: 13 additions & 1 deletion src/app/hooks/trading/usePairList.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { IPairData } from 'types/trading-pairs';
import { isMainnet, isStaging } from 'utils/classifiers';

// XUSD_legacy, cannot use getContract because we don't have a mainnet contract for it
const deprecatedPair = '0x74858FE37d391f81F89472e1D8BC8Ef9CF67B3b1'.toLowerCase();

export const usePairList = (pairs: IPairData[]) => {
if (!pairs) {
return [];
}

return Object.keys(pairs)
const pairList = Object.keys(pairs)
.map(key => pairs[key])
.filter((pair: IPairData) => {
return pair;
});

return isMainnet || isStaging
? pairList
: pairList.filter(
pair =>
pair.base_id.toLowerCase() !== deprecatedPair &&
pair.quote_id.toLowerCase() !== deprecatedPair,
);
};
24 changes: 1 addition & 23 deletions src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,11 @@ import { BridgeWithdrawPage } from './pages/BridgeWithdrawPage/Loadable';
import { FastBtcPage } from './pages/FastBtcPage/Loadable';
import { PageContainer } from './containers/PageContainer';
import 'react-toastify/dist/ReactToastify.css';
import { PerpetualPageLoadable } from './pages/PerpetualPage/Loadable';
import { PerpetualsPlaceholderPageLoadable } from './pages/PerpetualsPlaceholderPage/Loadable';
import { ReceiveRBTCPage } from './pages/ReceiveRBTCPage';
import { CompetitionPage } from './pages/PerpetualPage/components/CompetitionPage';
import { usePriceFeeds_tradingPairRates } from './hooks/price-feeds/usePriceFeeds_tradingPairRates';

const title = !isMainnet ? `Sovryn ${currentNetwork}` : 'Sovryn';

// TODO: Delete this once we go live, we may need it after the competition
const showPerps = !isMainnet; // !isMainnet || isStaging;

export function App() {
useAppTheme();

Expand Down Expand Up @@ -98,6 +92,7 @@ export function App() {
<Route exact path="/borrow" component={BorrowPage} />
<Route exact path="/stake" component={StakePage} />
<Redirect exact from="/liquidity" to="/yield-farm" />
<Redirect exact from="/perpetuals" to="/" />
<Route
exact
path="/yield-farm"
Expand Down Expand Up @@ -138,23 +133,6 @@ export function App() {
component={FastBtcPage}
/>
<Route exact path="/rbtc/" component={ReceiveRBTCPage} />

<Route
exact
path="/perpetuals"
component={
showPerps
? PerpetualPageLoadable
: PerpetualsPlaceholderPageLoadable
}
/>
{showPerps && (
<Route
exact
path="/perpetuals/competition"
component={CompetitionPage}
/>
)}
<Route component={NotFoundPage} />
</Switch>
</PageContainer>
Expand Down

0 comments on commit 252a15c

Please sign in to comment.