From 1264d91f5c8784b8496776efd9f9c0d2441cc8e3 Mon Sep 17 00:00:00 2001 From: hueso Date: Thu, 18 Jul 2024 18:43:07 -0300 Subject: [PATCH] =?UTF-8?q?G=C3=B6rli=20->=20Sepolia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/blockchain/addresses.ts | 12 +++++----- src/blockchain/events.ts | 22 ++++++++++--------- .../ListingComponent/ListingComponent.vue | 2 +- src/components/SearchComponent.vue | 18 +++++++-------- src/store/ether.ts | 10 ++++----- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/blockchain/addresses.ts b/src/blockchain/addresses.ts index 556797a..e736dac 100644 --- a/src/blockchain/addresses.ts +++ b/src/blockchain/addresses.ts @@ -5,7 +5,7 @@ const getTokenAddress = (network?: NetworkEnum): string => { const etherStore = useEtherStore(); const possibleTokenAddresses: { [key: string]: string } = { - Ethereum: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00", + Ethereum: "0x3eBE67A2C7bdB2081CBd34ba3281E90377462289", Polygon: "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29", Rootstock: "0xfE841c74250e57640390f46d914C88d22C51e82e", }; @@ -17,7 +17,7 @@ const getP2PixAddress = (network?: NetworkEnum): string => { const etherStore = useEtherStore(); const possibleP2PixAddresses: { [key: string]: string } = { - Ethereum: "0x2414817FF64A114d91eCFA16a834d3fCf69103d4", + Ethereum: "0xb7cD135F5eFD9760981e02E2a898790b688939fe", Polygon: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00", Rootstock: "0x98ba35eb14b38D6Aa709338283af3e922476dE34", }; @@ -29,7 +29,7 @@ const getProviderUrl = (): string => { const etherStore = useEtherStore(); const possibleProvidersUrls: { [key: string]: string } = { - Ethereum: import.meta.env.VITE_GOERLI_API_URL, + Ethereum: import.meta.env.VITE_SEPOLIA_API_URL, Polygon: import.meta.env.VITE_MUMBAI_API_URL, Rootstock: import.meta.env.VITE_RSK_API_URL, }; @@ -38,15 +38,13 @@ const getProviderUrl = (): string => { }; const possibleChains: { [key: string]: NetworkEnum } = { - "0x5": NetworkEnum.ethereum, - "5": NetworkEnum.ethereum, - "0x13881": NetworkEnum.polygon, + "11155111": NetworkEnum.ethereum, "80001": NetworkEnum.polygon, "31": NetworkEnum.rootstock, }; const network2Chain: { [key: string]: string } = { - Ethereum: "0x5", + Ethereum: "0xAA36A7", Polygon: "0x13881", Localhost: "0x7a69", Rootstock: "0x1f", diff --git a/src/blockchain/events.ts b/src/blockchain/events.ts index b4dc846..8bd8746 100644 --- a/src/blockchain/events.ts +++ b/src/blockchain/events.ts @@ -13,10 +13,10 @@ import type { Pix } from "@/model/Pix"; const getNetworksLiquidity = async (): Promise => { const etherStore = useEtherStore(); - const goerliProvider = new ethers.providers.JsonRpcProvider( - import.meta.env.VITE_GOERLI_API_URL, - 5 - ); // goerli provider + const sepoliaProvider = new ethers.providers.JsonRpcProvider( + import.meta.env.VITE_SEPOLIA_API_URL, + 11155111 + ); // sepolia provider const mumbaiProvider = new ethers.providers.JsonRpcProvider( import.meta.env.VITE_MUMBAI_API_URL, 80001 @@ -26,10 +26,10 @@ const getNetworksLiquidity = async (): Promise => { 31 ); // rootstock provider - const p2pContractGoerli = new ethers.Contract( + const p2pContractSepolia = new ethers.Contract( getP2PixAddress(NetworkEnum.ethereum), p2pix.abi, - goerliProvider + sepoliaProvider ); const p2pContractMumbai = new ethers.Contract( getP2PixAddress(NetworkEnum.polygon), @@ -44,21 +44,23 @@ const getNetworksLiquidity = async (): Promise => { ); etherStore.setLoadingNetworkLiquidity(true); - const depositListGoerli = await getValidDeposits( + + const depositListSepolia = await getValidDeposits( getTokenAddress(NetworkEnum.ethereum), - p2pContractGoerli - ); + p2pContractSepolia + ); const depositListMumbai = await getValidDeposits( getTokenAddress(NetworkEnum.polygon), p2pContractMumbai ); - etherStore.setDepositsValidListGoerli(depositListGoerli); const depositListRootstock = await getValidDeposits( getTokenAddress(NetworkEnum.rsktestnet), p2pContractRootstock ); + + etherStore.setDepositsValidListSepolia(depositListSepolia); etherStore.setDepositsValidListMumbai(depositListMumbai); etherStore.setDepositsValidListRootstock(depositListRootstock); etherStore.setLoadingNetworkLiquidity(false); diff --git a/src/components/ListingComponent/ListingComponent.vue b/src/components/ListingComponent/ListingComponent.vue index 4bb2d1c..327c2eb 100644 --- a/src/components/ListingComponent/ListingComponent.vue +++ b/src/components/ListingComponent/ListingComponent.vue @@ -107,7 +107,7 @@ const showInitialItems = (): void => { const openEtherscanUrl = (transactionHash: string): void => { const networkUrl = etherStore.networkName == NetworkEnum.ethereum - ? "goerli.etherscan.io" + ? "sepolia.etherscan.io" : "mumbai.polygonscan.com"; const url = `https://${networkUrl}/tx/${transactionHash}`; window.open(url, "_blank"); diff --git a/src/components/SearchComponent.vue b/src/components/SearchComponent.vue index 5077c6b..1cc7358 100644 --- a/src/components/SearchComponent.vue +++ b/src/components/SearchComponent.vue @@ -17,7 +17,7 @@ const etherStore = useEtherStore(); const { walletAddress, networkName, - depositsValidListGoerli, + depositsValidListSepolia, depositsValidListMumbai, loadingNetworkLiquidity, } = storeToRefs(etherStore); @@ -28,7 +28,7 @@ const enableConfirmButton = ref(false); const enableWalletButton = ref(false); const hasLiquidity = ref(true); const validDecimals = ref(true); -const selectedGoerliDeposit = ref(); +const selectedSepoliaDeposit = ref(); const selectedMumbaiDeposit = ref(); const selectedRootstockDeposit = ref(); @@ -45,7 +45,7 @@ const connectAccount = async (): Promise => { const emitConfirmButton = (): void => { const selectedDeposit = networkName.value == NetworkEnum.ethereum - ? selectedGoerliDeposit.value + ? selectedSepoliaDeposit.value : selectedMumbaiDeposit.value; emit("tokenBuy", selectedDeposit, tokenValue.value); }; @@ -69,7 +69,7 @@ const handleInputEvent = (event: any): void => { // Verify if there is a valid deposit to buy const verifyLiquidity = (): void => { enableConfirmButton.value = false; - selectedGoerliDeposit.value = undefined; + selectedSepoliaDeposit.value = undefined; selectedMumbaiDeposit.value = undefined; selectedRootstockDeposit.value = undefined; @@ -78,10 +78,10 @@ const verifyLiquidity = (): void => { return; } - selectedGoerliDeposit.value = verifyNetworkLiquidity( + selectedSepoliaDeposit.value = verifyNetworkLiquidity( tokenValue.value, walletAddress.value, - depositsValidListGoerli.value + depositsValidListSepolia.value ); selectedMumbaiDeposit.value = verifyNetworkLiquidity( tokenValue.value, @@ -90,7 +90,7 @@ const verifyLiquidity = (): void => { ); enableOrDisableConfirmButton(); - if (selectedGoerliDeposit.value || selectedMumbaiDeposit.value) { + if (selectedSepoliaDeposit.value || selectedMumbaiDeposit.value) { hasLiquidity.value = true; enableWalletButton.value = true; } else { @@ -100,7 +100,7 @@ const verifyLiquidity = (): void => { }; const enableOrDisableConfirmButton = (): void => { - if (selectedGoerliDeposit.value && networkName.value == NetworkEnum.ethereum) + if (selectedSepoliaDeposit.value && networkName.value == NetworkEnum.ethereum) enableConfirmButton.value = true; else if ( selectedMumbaiDeposit.value && @@ -185,7 +185,7 @@ watch(walletAddress, (): void => { src="@/assets/ethereum.svg" width="24" height="24" - v-if="selectedGoerliDeposit" + v-if="selectedSepoliaDeposit" /> diff --git a/src/store/ether.ts b/src/store/ether.ts index a361d94..0ff0aae 100644 --- a/src/store/ether.ts +++ b/src/store/ether.ts @@ -9,8 +9,8 @@ export const useEtherStore = defineStore("ether", { networkName: NetworkEnum.ethereum, loadingLock: false, sellerView: false, - // Depósitos válidos para compra GOERLI - depositsValidListGoerli: [] as ValidDeposit[], + // Depósitos válidos para compra SEPOLIA + depositsValidListSepolia: [] as ValidDeposit[], // Depósitos válidos para compra MUMBAI depositsValidListMumbai: [] as ValidDeposit[], loadingWalletTransactions: false, @@ -32,8 +32,8 @@ export const useEtherStore = defineStore("ether", { setSellerView(sellerView: boolean) { this.sellerView = sellerView; }, - setDepositsValidListGoerli(depositsValidList: ValidDeposit[]) { - this.depositsValidListGoerli = depositsValidList; + setDepositsValidListSepolia(depositsValidList: ValidDeposit[]) { + this.depositsValidListSepolia = depositsValidList; }, setDepositsValidListMumbai(depositsValidList: ValidDeposit[]) { this.depositsValidListMumbai = depositsValidList; @@ -52,7 +52,7 @@ export const useEtherStore = defineStore("ether", { getters: { getValidDepositByWalletAddress: (state) => { return (walletAddress: string) => - state.depositsValidListGoerli + state.depositsValidListSepolia .filter((deposit) => deposit.seller == walletAddress) .sort((a, b) => { return b.blockNumber - a.blockNumber;