Skip to content

Commit

Permalink
pr comments and changed to depUSDT
Browse files Browse the repository at this point in the history
  • Loading branch information
nattadex committed Jul 19, 2024
1 parent 7b922f2 commit 0e1668b
Show file tree
Hide file tree
Showing 28 changed files with 110 additions and 95 deletions.
4 changes: 2 additions & 2 deletions mobile-app/app/__mocks__/@waveshq/walletkit-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useWhaleApiClient = () => ({
toToken: {
id: "3",
symbol: "USDT",
displaySymbol: "csUSDT",
displaySymbol: "depUSDT",
},
bestPath: [
{
Expand All @@ -72,7 +72,7 @@ export const useWhaleApiClient = () => ({
tokenA: {
id: "3",
symbol: "USDT",
displaySymbol: "csUSDT",
displaySymbol: "depUSDT",
},
tokenB: {
id: "0",
Expand Down
47 changes: 31 additions & 16 deletions mobile-app/app/api/token/dusdt_converter.ts
Original file line number Diff line number Diff line change
@@ -1,75 +1,90 @@
const updated_dusdt_name = "depUSDT";

export function dusdt_converter_token(token: any) {
if (token.displayTextSymbol) {
return { ...token, displaySymbol: "csUSDT", displayTextSymbol: "csUSDT" };
return {
...token,
displaySymbol: updated_dusdt_name,
displayTextSymbol: updated_dusdt_name,
};
}
return { ...token, displaySymbol: "csUSDT" };
return {
...token,
displaySymbol: updated_dusdt_name,
name: "Playground depUSDT",
};
}

export function dusdt_converter_pool_pair(availablePairs: any) {
if (availablePairs.length > 1) {
return availablePairs.map((pair: any) => {
const updatedPair = {
return {
...pair,
data: {
...pair.data,
symbol: pair.data.symbol.replace(/dUSDT/g, "csUSDT"),
displaySymbol: pair.data.displaySymbol.replace(/dUSDT/g, "csUSDT"),
symbol: pair.data.symbol.replace(/dUSDT/g, updated_dusdt_name),
displaySymbol: pair.data.displaySymbol.replace(
/dUSDT/g,
updated_dusdt_name,
),
tokenA: {
...pair.data.tokenA,
symbol:
pair.data.tokenA.symbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: pair.data.tokenA.symbol,
displaySymbol:
pair.data.tokenA.displaySymbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: pair.data.tokenA.displaySymbol,
},
tokenB: {
...pair.data.tokenB,
symbol:
pair.data.tokenB.symbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: pair.data.tokenB.symbol,
displaySymbol:
pair.data.tokenB.displaySymbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: pair.data.tokenB.displaySymbol,
},
},
};
return updatedPair;
});
} else {
return {
...availablePairs,
data: {
...availablePairs.data,
symbol: availablePairs.data.symbol.replace(/dUSDT/g, "csUSDT"),
symbol: availablePairs.data.symbol.replace(
/dUSDT/g,
updated_dusdt_name,
),
displaySymbol: availablePairs.data.displaySymbol.replace(
/dUSDT/g,
"csUSDT",
updated_dusdt_name,
),
tokenA: {
...availablePairs.data.tokenA,
symbol:
availablePairs.data.tokenA.symbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: availablePairs.data.tokenA.symbol,
displaySymbol:
availablePairs.data.tokenA.displaySymbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: availablePairs.data.tokenA.displaySymbol,
},
tokenB: {
...availablePairs.data.tokenB,
symbol:
availablePairs.data.tokenB.symbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: availablePairs.data.tokenB.symbol,
displaySymbol:
availablePairs.data.tokenB.displaySymbol === "dUSDT"
? "csUSDT"
? updated_dusdt_name
: availablePairs.data.tokenB.displaySymbol,
},
},
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app/components/TokenDropdownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function TokenDropdownButton(props: {
status: TokenDropdownButtonStatus;
isEvmToken?: boolean;
}): JSX.Element {
if (props.tokenId === "3") {
if (props.symbol === "USDT") {
props = dusdt_converter_token(props);
}
const Icon =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Svg, { Circle, Path, SvgProps } from "react-native-svg";

export function csUSDT(props: SvgProps): JSX.Element {
export function depUSDT(props: SvgProps): JSX.Element {
return (
<Svg height={32} width={32} viewBox="0 0 32 32" {...props}>
<Circle cx={16} cy={16} fill="#D4ECE5" r={16} />
Expand Down
4 changes: 2 additions & 2 deletions mobile-app/app/components/icons/assets/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const icons = [
"dDOGE",
"dETH",
"dLTC",
"csUSDT",
"depUSDT",
"dUSDC",
"FAKE",
"dDUSD",
Expand All @@ -41,7 +41,7 @@ const icons = [
"dMSFT",
"dETH-DFI",
"dBTC-DFI",
"csUSDT-DFI",
"depUSDT-DFI",
"dDOGE-DFI",
"dLTC-DFI",
"dBCH-DFI",
Expand Down
4 changes: 2 additions & 2 deletions mobile-app/app/components/icons/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { dETH } from "./dETH";
import { DFI } from "./DFI";
import { dLTC } from "./dLTC";
import { dUSDC } from "./dUSDC";
import { csUSDT } from "./csUSDT";
import { depUSDT } from "./depUSDT";
import { dUSD } from "./dUSD";
import { DFIlogo } from "./plainDFI";
import { dEUROC } from "./dEUROC";
Expand Down Expand Up @@ -39,7 +39,7 @@ const mapping: Record<string, (props: SvgProps) => JSX.Element> = {
dDOGE: dDOGE,
dETH: dETH,
dLTC: dLTC,
csUSDT: csUSDT,
depUSDT: depUSDT,
dUSDC: dUSDC,
dDUSD: dUSD,
DUSD: dUSD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ export function AddLiquidityScreen(props: Props): JSX.Element {
...poolpair.tokenA,
displaySymbol:
poolpair.tokenA.id === "3"
? "csUSDT"
? "depUSDT"
: poolpair.tokenA.displaySymbol,
},
tokenB: {
...poolpair.tokenB,
displaySymbol:
poolpair.tokenB.id === "3"
? "csUSDT"
? "depUSDT"
: poolpair.tokenB.displaySymbol,
},
aSymbol,
Expand Down
6 changes: 3 additions & 3 deletions mobile-app/app/screens/AppNavigator/screens/Dex/DexScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { debounce } from "lodash";
import { HeaderSearchInput } from "@components/HeaderSearchInput";
import { ScrollView } from "react-native";
import { ScreenName } from "@screens/enum";
import { useFavouritePoolpairContext } from "@contexts/FavouritePoolpairContext";
import { EmptyActivePoolpair } from "./components/EmptyActivePoolPair";
import {
ButtonGroupTabKey,
Expand All @@ -32,7 +33,6 @@ import {
import { ButtonGroup } from "./components/ButtonGroup";
import { DexParamList } from "./DexNavigator";
import { AssetsFilterItem } from "../Portfolio/components/AssetsFilterRow";
import { useFavouritePoolpairContext } from "../../../../contexts/FavouritePoolpairContext";

enum TabKey {
YourPoolPair = "YOUR_POOL_PAIRS",
Expand Down Expand Up @@ -313,14 +313,14 @@ export function DexScreen(): JSX.Element {
...item.data.tokenA,
displaySymbol:
item.data.tokenA.id === "3"
? "csUSDT"
? "depUSDT"
: item.data.tokenA.displaySymbol,
},
tokenB: {
...item.data.tokenB,
displaySymbol:
item.data.tokenB.id === "3"
? "csUSDT"
? "depUSDT"
: item.data.tokenB.displaySymbol,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export function useDexStabilization(
const dUSDCDUSDPair = pairs.find(
(p) => p.data.displaySymbol === "dUSDC-DUSD",
);
const csUSDTDUSDPair = pairs.find(
(p) => p.data.displaySymbol === "csUSDT-DUSD",
const depUSDTDUSDPair = pairs.find(
(p) => p.data.displaySymbol === "depUSDT-DUSD",
);
const dEUROCDUSDPair = pairs.find(
(p) => p.data.displaySymbol === "dEUROC-DUSD",
Expand All @@ -104,11 +104,11 @@ export function useDexStabilization(
) {
fee = dUSDCDUSDPair.data.tokenB.fee?.pct;
} else if (
csUSDTDUSDPair !== undefined &&
depUSDTDUSDPair !== undefined &&
tokenADisplaySymbol === "DUSD" &&
tokenBDisplaySymbol === "csUSDT"
tokenBDisplaySymbol === "depUSDT"
) {
fee = csUSDTDUSDPair.data.tokenB.fee?.pct;
fee = depUSDTDUSDPair.data.tokenB.fee?.pct;
} else if (
dEUROCDUSDPair !== undefined &&
tokenADisplaySymbol === "DUSD" &&
Expand All @@ -135,9 +135,9 @@ export function useDexStabilization(
highFeesUrl = "https://defiscan.live/dex/DUSD";
} else if (
pair.tokenADisplaySymbol === "DUSD" &&
pair.tokenBDisplaySymbol === "csUSDT"
pair.tokenBDisplaySymbol === "depUSDT"
) {
highFeesUrl = "https://defiscan.live/dex/csUSDT-DUSD";
highFeesUrl = "https://defiscan.live/dex/depUSDT-DUSD";
} else if (
pair.tokenADisplaySymbol === "DUSD" &&
pair.tokenBDisplaySymbol === "dUSDC"
Expand Down Expand Up @@ -349,7 +349,7 @@ export function useDexStabilization(
bestPath.length === 1 &&
((tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "DFI") ||
(tokenA.displaySymbol === "DUSD" &&
tokenB.displaySymbol === "csUSDT") ||
tokenB.displaySymbol === "depUSDT") ||
(tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "dUSDC") ||
(tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "dEUROC"))
) {
Expand All @@ -376,7 +376,7 @@ export function useDexStabilization(
bestPath,
[
{ tokenADisplaySymbol: "DUSD", tokenBDisplaySymbol: "DFI" },
{ tokenADisplaySymbol: "DUSD", tokenBDisplaySymbol: "csUSDT" },
{ tokenADisplaySymbol: "DUSD", tokenBDisplaySymbol: "depUSDT" },
{ tokenADisplaySymbol: "DUSD", tokenBDisplaySymbol: "dUSDC" },
{ tokenADisplaySymbol: "DUSD", tokenBDisplaySymbol: "dEUROC" },
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export function VaultDetailCollateralsRow({
collateralItem={collateralItem}
totalCollateralValue={new BigNumber(vault.collateralValue)}
displaySymbol={
collateral.id === "3" ? "csUSDT" : collateral.displaySymbol
collateral.id === "3" ? "depUSDT" : collateral.displaySymbol
}
amount={new BigNumber(collateral.amount)}
onAddCollateralPress={() => onAddPress(collateralItem)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function VaultCard(props: VaultCardProps): JSX.Element {
testID={`${props.testID}_collateral_token_group`}
symbols={vault.collateralAmounts?.map((collateral) =>
collateral.displaySymbol === "dUSDT"
? "csUSDT"
? "depUSDT"
: collateral.displaySymbol,
)}
maxIconToDisplay={6}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useCollateralTokenList() {
token: {
...c.token,
displaySymbol:
c.token.id === "3" ? "csUSDT" : c.token.displaySymbol,
c.token.id === "3" ? "depUSDT" : c.token.displaySymbol,
},
available: getTokenAmount(c.token.id),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("Token Best Path - Get Best Path (DEX)", () => {
status: true,
tokenA: {
symbol: "USDT",
displaySymbol: "csUSDT",
displaySymbol: "depUSDT",
id: "14",
reserve: pair2ReserveA,
blockCommission: "0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("Token Price - Get Token Price (DEX)", () => {
status: true,
tokenA: {
symbol: "USDT",
displaySymbol: "csUSDT",
displaySymbol: "depUSDT",
id: "14",
reserve: pair2ReserveA,
blockCommission: "0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
0,
).toFixed(8)
: t.amount,
displaySymbol: t.id === "3" ? "csUSDT" : t.displaySymbol,
displaySymbol: t.id === "3" ? "depUSDT" : t.displaySymbol,
});
}
}, [JSON.stringify(tokens)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ const usePoolPairToken = (

if (t !== undefined) {
if (t.id === "3") {
const csUSDTtoken = dusdt_converter_token(token);
setToken(csUSDTtoken);
const depUSDTtoken = dusdt_converter_token(token);
setToken(depUSDTtoken);
} else {
setToken(t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function TokensVsUtxoFaq(): JSX.Element {
{
text: translate(
"components/UtxoVsTokenFaq",
"Swapping DFI with other tokens (e.g. dBTC, dETH, csUSDT)",
"Swapping DFI with other tokens (e.g. dBTC, dETH, depUSDT)",
),
type: "bullet",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const getDexPrice = (price: {
denomination: {
id: "3",
symbol: "USDT",
displaySymbol: "csUSDT",
name: "Playground USDT",
displaySymbol: "depUSDT",
name: "Playground csUSDT",
},
dexPrices: {
DUSD: {
Expand Down
Loading

0 comments on commit 0e1668b

Please sign in to comment.