From 07c6cdd2560bc2a1d9c32779d3ebdd16d1c15187 Mon Sep 17 00:00:00 2001 From: Norton Andreev Date: Tue, 17 Dec 2024 11:05:36 +0200 Subject: [PATCH] web-wallet: Prepare Migration for release Resolves #3203 --- web-wallet/README.md | 1 - .../MigrateContract/MigrateContract.svelte | 11 +++++++---- .../containers/MigrateContract/tokenConfig.js | 18 ++++++++---------- .../lib/containers/MigrateContract/tokens.d.ts | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/web-wallet/README.md b/web-wallet/README.md index 117137c3e9..0fa42764c1 100644 --- a/web-wallet/README.md +++ b/web-wallet/README.md @@ -44,7 +44,6 @@ VITE_GAS_LIMIT_LOWER=10000000 VITE_GAS_LIMIT_UPPER=1000000000 VITE_GAS_PRICE_DEFAULT=1 VITE_GAS_PRICE_LOWER=1 -VITE_MIGRATE_CONTRACT="" VITE_MODE_MAINTENANCE=false VITE_NODE_URL="" # connect to a specific node ``` diff --git a/web-wallet/src/lib/containers/MigrateContract/MigrateContract.svelte b/web-wallet/src/lib/containers/MigrateContract/MigrateContract.svelte index b5c0c8d02d..ae969c3f09 100644 --- a/web-wallet/src/lib/containers/MigrateContract/MigrateContract.svelte +++ b/web-wallet/src/lib/containers/MigrateContract/MigrateContract.svelte @@ -34,7 +34,7 @@ Textbox, } from "$lib/dusk/components"; import { logo } from "$lib/dusk/icons"; - import { settingsStore } from "$lib/stores"; + import { settingsStore, walletStore } from "$lib/stores"; import { account, modal, @@ -92,6 +92,9 @@ /** @type {boolean} */ let isInputDisabled = false; + $: ({ currentProfile } = $walletStore); + $: moonlightAccount = currentProfile?.account.toString(); + $: walletState = { address: $account?.address, chainId: $account?.chainId, @@ -163,7 +166,7 @@ } return await getBalanceOfCoin( walletAccount.address, - tokens[network][selectedChain].contract + tokens[network][selectedChain].tokenContract ); } catch (err) { return 0n; @@ -338,14 +341,14 @@ isInputDisabled = false; }} amount={parseUnits(amount.replace(",", "."), ercDecimals)} - chainContract={tokens[network][selectedChain].contract} + chainContract={tokens[network][selectedChain].tokenContract} migrationContract={tokens[network][selectedChain].migrationContract} /> {:else if migrationStep === 1} migrationStep++} amount={parseUnits(amount.replace(",", "."), ercDecimals)} - currentAddress={walletState.address ?? ""} + currentAddress={moonlightAccount ?? ""} migrationContract={tokens[network][selectedChain].migrationContract} /> {:else} diff --git a/web-wallet/src/lib/containers/MigrateContract/tokenConfig.js b/web-wallet/src/lib/containers/MigrateContract/tokenConfig.js index 1e62f713d2..546284d1cb 100644 --- a/web-wallet/src/lib/containers/MigrateContract/tokenConfig.js +++ b/web-wallet/src/lib/containers/MigrateContract/tokenConfig.js @@ -1,35 +1,33 @@ import { bsc, mainnet, sepolia } from "viem/chains"; -const mainnetMigrateContract = import.meta.env.VITE_MIGRATE_CONTRACT; - /** @type {Tokens} */ export const tokens = { mainnet: { "BEP-20": { chainId: bsc.id, - contract: "0xb2bd0749dbe21f623d9baba856d3b0f0e1bfec9c", - migrationContract: mainnetMigrateContract, + migrationContract: "0x9f5d1c067710fc6ed49a6444afd69b64799a57b6", name: "BEP-20", + tokenContract: "0xb2bd0749dbe21f623d9baba856d3b0f0e1bfec9c", }, "ERC-20": { chainId: mainnet.id, - contract: "0x940a2db1b7008b6c776d4faaca729d6d4a4aa551", - migrationContract: mainnetMigrateContract, + migrationContract: "0x9f5d1c067710fc6ed49a6444afd69b64799a57b6", name: "ERC-20", + tokenContract: "0x940a2db1b7008b6c776d4faaca729d6d4a4aa551", }, }, testnet: { "BEP-20": { chainId: sepolia.id, - contract: "0xC416f5d2AE6BAec2a23f412Df11166afC35CAba2", - migrationContract: "0x9f5d1c067710fc6ed49a6444afd69b64799a57b6", + migrationContract: "0x1Bb81fbd735854Ed901aD7Aa1f5F72F64E5841Fc", name: "BEP-20", + tokenContract: "0xC416f5d2AE6BAec2a23f412Df11166afC35CAba2", }, "ERC-20": { chainId: sepolia.id, - contract: "0x92DA9BE2039E818bB78223A6BA7C85CC2b17D8D5", - migrationContract: "0x63fd2B12034e108BCe73e8832b7dabC8bd67f738", + migrationContract: "0x81F15Ed1D87A6C840E410D7740D581e36c661640", name: "ERC-20", + tokenContract: "0x92DA9BE2039E818bB78223A6BA7C85CC2b17D8D5", }, }, }; diff --git a/web-wallet/src/lib/containers/MigrateContract/tokens.d.ts b/web-wallet/src/lib/containers/MigrateContract/tokens.d.ts index 43cd5ad808..ac1995507a 100644 --- a/web-wallet/src/lib/containers/MigrateContract/tokens.d.ts +++ b/web-wallet/src/lib/containers/MigrateContract/tokens.d.ts @@ -2,7 +2,7 @@ type HexString = `0x${string}`; type TokenInfo = { chainId: number; - contract: HexString; + tokenContract: HexString; migrationContract: HexString; name: TokenNames; };