From 55700f7924e36e86f1160428a8a15dac0723c37c Mon Sep 17 00:00:00 2001 From: elocin Date: Tue, 30 Apr 2024 10:27:38 +0800 Subject: [PATCH] fix(ui-ux): add dxchf backing address to proof of backing (#1933) * added dXCHF * added dXCHF in e2e test * Check if cake exists --- .../proof-of-backing/backingAddresses.ts | 4 + src/constants/TokenBackedAddress.ts | 12 +- .../_components/BackingTable.tsx | 2 +- src/pages/tokens/[id].page.tsx | 153 ++++++++++-------- 4 files changed, 106 insertions(+), 65 deletions(-) diff --git a/cypress/fixtures/proof-of-backing/backingAddresses.ts b/cypress/fixtures/proof-of-backing/backingAddresses.ts index 891c1b6ff..c038c0842 100644 --- a/cypress/fixtures/proof-of-backing/backingAddresses.ts +++ b/cypress/fixtures/proof-of-backing/backingAddresses.ts @@ -70,4 +70,8 @@ export const quantumBackingAddresses = [ token: "dEUROC", link: "https://etherscan.io/address/0xc3F5f07143c567D657beFAE6752382b160d17317", }, + { + token: "dXCHF", + link: "https://etherscan.io/address/0xc3F5f07143c567D657beFAE6752382b160d17317", + }, ]; diff --git a/src/constants/TokenBackedAddress.ts b/src/constants/TokenBackedAddress.ts index 7d889169d..986677621 100644 --- a/src/constants/TokenBackedAddress.ts +++ b/src/constants/TokenBackedAddress.ts @@ -1,6 +1,6 @@ interface BackedAddress { [key: string]: { - cake: { + cake?: { link: string; address: string; }; @@ -109,6 +109,12 @@ export const TOKEN_BACKED_ADDRESS: BackedAddress = { "0xe319ee27de5d3cb4a2345c8b714a69d6710ca05395e3709983d886061b1b818d", }, }, + XCHF: { + quantum: { + link: "https://etherscan.io/address/0xc3F5f07143c567D657beFAE6752382b160d17317", + address: "0xc3F5f07143c567D657beFAE6752382b160d17317", + }, + }, }; interface TokenBacked { @@ -165,4 +171,8 @@ export const TOKEN_BACKED: TokenBacked[] = [ name: "dSUI", symbol: "SUI", }, + { + name: "dXCHF", + symbol: "XCHF", + }, ]; diff --git a/src/pages/proof-of-backing/_components/BackingTable.tsx b/src/pages/proof-of-backing/_components/BackingTable.tsx index 5b8907110..1223c4e55 100644 --- a/src/pages/proof-of-backing/_components/BackingTable.tsx +++ b/src/pages/proof-of-backing/_components/BackingTable.tsx @@ -127,7 +127,7 @@ function TableRow({ {backedAddress.cake.address} ) : ( -
+
N/A
)} diff --git a/src/pages/tokens/[id].page.tsx b/src/pages/tokens/[id].page.tsx index 1dccba4be..9676b672a 100644 --- a/src/pages/tokens/[id].page.tsx +++ b/src/pages/tokens/[id].page.tsx @@ -281,80 +281,107 @@ function BackingAddress({ tokenSymbol }: { tokenSymbol: string }): JSX.Element { {(() => { switch (tokenSymbol) { case "BCH": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.BCH.cake) { + return ( + + ); + } + break; case "LTC": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.LTC.cake) { + return ( + + ); + } + break; case "DOGE": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.DOGE.cake) { + return ( + + ); + } + break; case "BTC": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.BTC.cake) { + return ( + + ); + } + break; case "MATIC": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.MATIC.cake) { + return ( + + ); + } + break; case "SOL": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.SOL.cake) { + return ( + + ); + } + break; case "DOT": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.DOT.cake) { + return ( + + ); + } + break; case "SUI": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.SUI.cake) { + return ( + + ); + } + break; case "ETH": case "USDC": case "USDT": case "EUROC": - return ( - - ); + if (TOKEN_BACKED_ADDRESS.ETH.cake) { + return ( + + ); + } + break; } })()}