Görli -> Sepolia
Some checks failed
Some checks failed
This commit is contained in:
parent
2c04e6f0de
commit
fbe32e78ab
@ -5,7 +5,7 @@ const getTokenAddress = (network?: NetworkEnum): string => {
|
|||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const possibleTokenAddresses: { [key: string]: string } = {
|
const possibleTokenAddresses: { [key: string]: string } = {
|
||||||
Ethereum: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
|
Ethereum: "0x3eBE67A2C7bdB2081CBd34ba3281E90377462289",
|
||||||
Polygon: "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
|
Polygon: "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
|
||||||
Rootstock: "0xfE841c74250e57640390f46d914C88d22C51e82e",
|
Rootstock: "0xfE841c74250e57640390f46d914C88d22C51e82e",
|
||||||
};
|
};
|
||||||
@ -17,7 +17,7 @@ const getP2PixAddress = (network?: NetworkEnum): string => {
|
|||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const possibleP2PixAddresses: { [key: string]: string } = {
|
const possibleP2PixAddresses: { [key: string]: string } = {
|
||||||
Ethereum: "0x2414817FF64A114d91eCFA16a834d3fCf69103d4",
|
Ethereum: "0xb7cD135F5eFD9760981e02E2a898790b688939fe",
|
||||||
Polygon: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
|
Polygon: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
|
||||||
Rootstock: "0x98ba35eb14b38D6Aa709338283af3e922476dE34",
|
Rootstock: "0x98ba35eb14b38D6Aa709338283af3e922476dE34",
|
||||||
};
|
};
|
||||||
@ -29,7 +29,7 @@ const getProviderUrl = (): string => {
|
|||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const possibleProvidersUrls: { [key: string]: string } = {
|
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,
|
Polygon: import.meta.env.VITE_MUMBAI_API_URL,
|
||||||
Rootstock: import.meta.env.VITE_RSK_API_URL,
|
Rootstock: import.meta.env.VITE_RSK_API_URL,
|
||||||
};
|
};
|
||||||
@ -38,15 +38,13 @@ const getProviderUrl = (): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const possibleChains: { [key: string]: NetworkEnum } = {
|
const possibleChains: { [key: string]: NetworkEnum } = {
|
||||||
"0x5": NetworkEnum.ethereum,
|
"11155111": NetworkEnum.ethereum,
|
||||||
"5": NetworkEnum.ethereum,
|
|
||||||
"0x13881": NetworkEnum.polygon,
|
|
||||||
"80001": NetworkEnum.polygon,
|
"80001": NetworkEnum.polygon,
|
||||||
"31": NetworkEnum.rootstock,
|
"31": NetworkEnum.rootstock,
|
||||||
};
|
};
|
||||||
|
|
||||||
const network2Chain: { [key: string]: string } = {
|
const network2Chain: { [key: string]: string } = {
|
||||||
Ethereum: "0x5",
|
Ethereum: "0xAA36A7",
|
||||||
Polygon: "0x13881",
|
Polygon: "0x13881",
|
||||||
Localhost: "0x7a69",
|
Localhost: "0x7a69",
|
||||||
Rootstock: "0x1f",
|
Rootstock: "0x1f",
|
||||||
|
@ -13,10 +13,10 @@ import type { Pix } from "@/model/Pix";
|
|||||||
const getNetworksLiquidity = async (): Promise<void> => {
|
const getNetworksLiquidity = async (): Promise<void> => {
|
||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
|
|
||||||
const goerliProvider = new ethers.providers.JsonRpcProvider(
|
const sepoliaProvider = new ethers.providers.JsonRpcProvider(
|
||||||
import.meta.env.VITE_GOERLI_API_URL,
|
import.meta.env.VITE_SEPOLIA_API_URL,
|
||||||
5
|
11155111
|
||||||
); // goerli provider
|
); // sepolia provider
|
||||||
const mumbaiProvider = new ethers.providers.JsonRpcProvider(
|
const mumbaiProvider = new ethers.providers.JsonRpcProvider(
|
||||||
import.meta.env.VITE_MUMBAI_API_URL,
|
import.meta.env.VITE_MUMBAI_API_URL,
|
||||||
80001
|
80001
|
||||||
@ -26,10 +26,10 @@ const getNetworksLiquidity = async (): Promise<void> => {
|
|||||||
31
|
31
|
||||||
); // rootstock provider
|
); // rootstock provider
|
||||||
|
|
||||||
const p2pContractGoerli = new ethers.Contract(
|
const p2pContractSepolia = new ethers.Contract(
|
||||||
getP2PixAddress(NetworkEnum.ethereum),
|
getP2PixAddress(NetworkEnum.ethereum),
|
||||||
p2pix.abi,
|
p2pix.abi,
|
||||||
goerliProvider
|
sepoliaProvider
|
||||||
);
|
);
|
||||||
const p2pContractMumbai = new ethers.Contract(
|
const p2pContractMumbai = new ethers.Contract(
|
||||||
getP2PixAddress(NetworkEnum.polygon),
|
getP2PixAddress(NetworkEnum.polygon),
|
||||||
@ -44,21 +44,23 @@ const getNetworksLiquidity = async (): Promise<void> => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
etherStore.setLoadingNetworkLiquidity(true);
|
etherStore.setLoadingNetworkLiquidity(true);
|
||||||
const depositListGoerli = await getValidDeposits(
|
|
||||||
|
const depositListSepolia = await getValidDeposits(
|
||||||
getTokenAddress(NetworkEnum.ethereum),
|
getTokenAddress(NetworkEnum.ethereum),
|
||||||
p2pContractGoerli
|
p2pContractSepolia
|
||||||
);
|
);
|
||||||
|
|
||||||
const depositListMumbai = await getValidDeposits(
|
const depositListMumbai = await getValidDeposits(
|
||||||
getTokenAddress(NetworkEnum.polygon),
|
getTokenAddress(NetworkEnum.polygon),
|
||||||
p2pContractMumbai
|
p2pContractMumbai
|
||||||
);
|
);
|
||||||
|
|
||||||
etherStore.setDepositsValidListGoerli(depositListGoerli);
|
|
||||||
const depositListRootstock = await getValidDeposits(
|
const depositListRootstock = await getValidDeposits(
|
||||||
getTokenAddress(NetworkEnum.rootstock),
|
getTokenAddress(NetworkEnum.rootstock),
|
||||||
p2pContractRootstock
|
p2pContractRootstock
|
||||||
);
|
);
|
||||||
|
|
||||||
|
etherStore.setDepositsValidListSepolia(depositListSepolia);
|
||||||
etherStore.setDepositsValidListMumbai(depositListMumbai);
|
etherStore.setDepositsValidListMumbai(depositListMumbai);
|
||||||
etherStore.setDepositsValidListRootstock(depositListRootstock);
|
etherStore.setDepositsValidListRootstock(depositListRootstock);
|
||||||
etherStore.setLoadingNetworkLiquidity(false);
|
etherStore.setLoadingNetworkLiquidity(false);
|
||||||
|
@ -107,7 +107,7 @@ const showInitialItems = (): void => {
|
|||||||
const openEtherscanUrl = (transactionHash: string): void => {
|
const openEtherscanUrl = (transactionHash: string): void => {
|
||||||
const networkUrl =
|
const networkUrl =
|
||||||
etherStore.networkName == NetworkEnum.ethereum
|
etherStore.networkName == NetworkEnum.ethereum
|
||||||
? "goerli.etherscan.io"
|
? "sepolia.etherscan.io"
|
||||||
: "mumbai.polygonscan.com";
|
: "mumbai.polygonscan.com";
|
||||||
const url = `https://${networkUrl}/tx/${transactionHash}`;
|
const url = `https://${networkUrl}/tx/${transactionHash}`;
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
|
@ -17,7 +17,7 @@ const etherStore = useEtherStore();
|
|||||||
const {
|
const {
|
||||||
walletAddress,
|
walletAddress,
|
||||||
networkName,
|
networkName,
|
||||||
depositsValidListGoerli,
|
depositsValidListSepolia,
|
||||||
depositsValidListMumbai,
|
depositsValidListMumbai,
|
||||||
loadingNetworkLiquidity,
|
loadingNetworkLiquidity,
|
||||||
} = storeToRefs(etherStore);
|
} = storeToRefs(etherStore);
|
||||||
@ -28,7 +28,7 @@ const enableConfirmButton = ref<boolean>(false);
|
|||||||
const enableWalletButton = ref<boolean>(false);
|
const enableWalletButton = ref<boolean>(false);
|
||||||
const hasLiquidity = ref<boolean>(true);
|
const hasLiquidity = ref<boolean>(true);
|
||||||
const validDecimals = ref<boolean>(true);
|
const validDecimals = ref<boolean>(true);
|
||||||
const selectedGoerliDeposit = ref<ValidDeposit>();
|
const selectedSepoliaDeposit = ref<ValidDeposit>();
|
||||||
const selectedMumbaiDeposit = ref<ValidDeposit>();
|
const selectedMumbaiDeposit = ref<ValidDeposit>();
|
||||||
const selectedRootstockDeposit = ref<ValidDeposit>();
|
const selectedRootstockDeposit = ref<ValidDeposit>();
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ const connectAccount = async (): Promise<void> => {
|
|||||||
const emitConfirmButton = (): void => {
|
const emitConfirmButton = (): void => {
|
||||||
const selectedDeposit =
|
const selectedDeposit =
|
||||||
networkName.value == NetworkEnum.ethereum
|
networkName.value == NetworkEnum.ethereum
|
||||||
? selectedGoerliDeposit.value
|
? selectedSepoliaDeposit.value
|
||||||
: selectedMumbaiDeposit.value;
|
: selectedMumbaiDeposit.value;
|
||||||
emit("tokenBuy", selectedDeposit, tokenValue.value);
|
emit("tokenBuy", selectedDeposit, tokenValue.value);
|
||||||
};
|
};
|
||||||
@ -69,7 +69,7 @@ const handleInputEvent = (event: any): void => {
|
|||||||
// Verify if there is a valid deposit to buy
|
// Verify if there is a valid deposit to buy
|
||||||
const verifyLiquidity = (): void => {
|
const verifyLiquidity = (): void => {
|
||||||
enableConfirmButton.value = false;
|
enableConfirmButton.value = false;
|
||||||
selectedGoerliDeposit.value = undefined;
|
selectedSepoliaDeposit.value = undefined;
|
||||||
selectedMumbaiDeposit.value = undefined;
|
selectedMumbaiDeposit.value = undefined;
|
||||||
selectedRootstockDeposit.value = undefined;
|
selectedRootstockDeposit.value = undefined;
|
||||||
|
|
||||||
@ -78,10 +78,10 @@ const verifyLiquidity = (): void => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedGoerliDeposit.value = verifyNetworkLiquidity(
|
selectedSepoliaDeposit.value = verifyNetworkLiquidity(
|
||||||
tokenValue.value,
|
tokenValue.value,
|
||||||
walletAddress.value,
|
walletAddress.value,
|
||||||
depositsValidListGoerli.value
|
depositsValidListSepolia.value
|
||||||
);
|
);
|
||||||
selectedMumbaiDeposit.value = verifyNetworkLiquidity(
|
selectedMumbaiDeposit.value = verifyNetworkLiquidity(
|
||||||
tokenValue.value,
|
tokenValue.value,
|
||||||
@ -90,7 +90,7 @@ const verifyLiquidity = (): void => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
enableOrDisableConfirmButton();
|
enableOrDisableConfirmButton();
|
||||||
if (selectedGoerliDeposit.value || selectedMumbaiDeposit.value) {
|
if (selectedSepoliaDeposit.value || selectedMumbaiDeposit.value) {
|
||||||
hasLiquidity.value = true;
|
hasLiquidity.value = true;
|
||||||
enableWalletButton.value = true;
|
enableWalletButton.value = true;
|
||||||
} else {
|
} else {
|
||||||
@ -100,7 +100,7 @@ const verifyLiquidity = (): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const enableOrDisableConfirmButton = (): void => {
|
const enableOrDisableConfirmButton = (): void => {
|
||||||
if (selectedGoerliDeposit.value && networkName.value == NetworkEnum.ethereum)
|
if (selectedSepoliaDeposit.value && networkName.value == NetworkEnum.ethereum)
|
||||||
enableConfirmButton.value = true;
|
enableConfirmButton.value = true;
|
||||||
else if (
|
else if (
|
||||||
selectedMumbaiDeposit.value &&
|
selectedMumbaiDeposit.value &&
|
||||||
@ -185,7 +185,7 @@ watch(walletAddress, (): void => {
|
|||||||
src="@/assets/ethereum.svg"
|
src="@/assets/ethereum.svg"
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
v-if="selectedGoerliDeposit"
|
v-if="selectedSepoliaDeposit"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,8 +9,8 @@ export const useEtherStore = defineStore("ether", {
|
|||||||
networkName: NetworkEnum.ethereum,
|
networkName: NetworkEnum.ethereum,
|
||||||
loadingLock: false,
|
loadingLock: false,
|
||||||
sellerView: false,
|
sellerView: false,
|
||||||
// Depósitos válidos para compra GOERLI
|
// Depósitos válidos para compra SEPOLIA
|
||||||
depositsValidListGoerli: [] as ValidDeposit[],
|
depositsValidListSepolia: [] as ValidDeposit[],
|
||||||
// Depósitos válidos para compra MUMBAI
|
// Depósitos válidos para compra MUMBAI
|
||||||
depositsValidListMumbai: [] as ValidDeposit[],
|
depositsValidListMumbai: [] as ValidDeposit[],
|
||||||
// Depósitos válidos para compra ROOTSTOCK
|
// Depósitos válidos para compra ROOTSTOCK
|
||||||
@ -34,8 +34,8 @@ export const useEtherStore = defineStore("ether", {
|
|||||||
setSellerView(sellerView: boolean) {
|
setSellerView(sellerView: boolean) {
|
||||||
this.sellerView = sellerView;
|
this.sellerView = sellerView;
|
||||||
},
|
},
|
||||||
setDepositsValidListGoerli(depositsValidList: ValidDeposit[]) {
|
setDepositsValidListSepolia(depositsValidList: ValidDeposit[]) {
|
||||||
this.depositsValidListGoerli = depositsValidList;
|
this.depositsValidListSepolia = depositsValidList;
|
||||||
},
|
},
|
||||||
setDepositsValidListMumbai(depositsValidList: ValidDeposit[]) {
|
setDepositsValidListMumbai(depositsValidList: ValidDeposit[]) {
|
||||||
this.depositsValidListMumbai = depositsValidList;
|
this.depositsValidListMumbai = depositsValidList;
|
||||||
@ -54,7 +54,7 @@ export const useEtherStore = defineStore("ether", {
|
|||||||
getters: {
|
getters: {
|
||||||
getValidDepositByWalletAddress: (state) => {
|
getValidDepositByWalletAddress: (state) => {
|
||||||
return (walletAddress: string) =>
|
return (walletAddress: string) =>
|
||||||
state.depositsValidListGoerli
|
state.depositsValidListSepolia
|
||||||
.filter((deposit) => deposit.seller == walletAddress)
|
.filter((deposit) => deposit.seller == walletAddress)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return b.blockNumber - a.blockNumber;
|
return b.blockNumber - a.blockNumber;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user