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 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",
|
||||
|
@ -13,10 +13,10 @@ import type { Pix } from "@/model/Pix";
|
||||
const getNetworksLiquidity = async (): Promise<void> => {
|
||||
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<void> => {
|
||||
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,9 +44,10 @@ const getNetworksLiquidity = async (): Promise<void> => {
|
||||
);
|
||||
|
||||
etherStore.setLoadingNetworkLiquidity(true);
|
||||
const depositListGoerli = await getValidDeposits(
|
||||
|
||||
const depositListSepolia = await getValidDeposits(
|
||||
getTokenAddress(NetworkEnum.ethereum),
|
||||
p2pContractGoerli
|
||||
p2pContractSepolia
|
||||
);
|
||||
|
||||
const depositListMumbai = await getValidDeposits(
|
||||
@ -54,11 +55,12 @@ const getNetworksLiquidity = async (): Promise<void> => {
|
||||
p2pContractMumbai
|
||||
);
|
||||
|
||||
etherStore.setDepositsValidListGoerli(depositListGoerli);
|
||||
const depositListRootstock = await getValidDeposits(
|
||||
getTokenAddress(NetworkEnum.rootstock),
|
||||
p2pContractRootstock
|
||||
);
|
||||
|
||||
etherStore.setDepositsValidListSepolia(depositListSepolia);
|
||||
etherStore.setDepositsValidListMumbai(depositListMumbai);
|
||||
etherStore.setDepositsValidListRootstock(depositListRootstock);
|
||||
etherStore.setLoadingNetworkLiquidity(false);
|
||||
|
@ -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");
|
||||
|
@ -17,7 +17,7 @@ const etherStore = useEtherStore();
|
||||
const {
|
||||
walletAddress,
|
||||
networkName,
|
||||
depositsValidListGoerli,
|
||||
depositsValidListSepolia,
|
||||
depositsValidListMumbai,
|
||||
loadingNetworkLiquidity,
|
||||
} = storeToRefs(etherStore);
|
||||
@ -28,7 +28,7 @@ const enableConfirmButton = ref<boolean>(false);
|
||||
const enableWalletButton = ref<boolean>(false);
|
||||
const hasLiquidity = ref<boolean>(true);
|
||||
const validDecimals = ref<boolean>(true);
|
||||
const selectedGoerliDeposit = ref<ValidDeposit>();
|
||||
const selectedSepoliaDeposit = ref<ValidDeposit>();
|
||||
const selectedMumbaiDeposit = ref<ValidDeposit>();
|
||||
const selectedRootstockDeposit = ref<ValidDeposit>();
|
||||
|
||||
@ -45,7 +45,7 @@ const connectAccount = async (): Promise<void> => {
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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[],
|
||||
// Depósitos válidos para compra ROOTSTOCK
|
||||
@ -34,8 +34,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;
|
||||
@ -54,7 +54,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user