4 Commits

Author SHA1 Message Date
hueso
0a51a80e0c Discord -> LinkedIn
Some checks failed
Deploy FrontEnd / deploy-staging (push) Has been cancelled
Deploy FrontEnd / deploy-production (push) Has been cancelled
CI script / lint (push) Has been cancelled
CI script / build (push) Has been cancelled
CI script / SonarCloud (push) Has been cancelled
2024-07-31 13:08:00 -03:00
hueso
8ad42cc0f2 background optimization 2024-07-31 13:07:40 -03:00
hueso
ae60edd324 Network selection overhaul 2024-07-31 12:32:44 -03:00
hueso
fbe32e78ab Görli -> Sepolia
Some checks failed
Deploy FrontEnd / deploy-staging (push) Has been cancelled
Deploy FrontEnd / deploy-production (push) Has been cancelled
CI script / lint (push) Has been cancelled
CI script / build (push) Has been cancelled
CI script / SonarCloud (push) Has been cancelled
2024-07-18 19:37:39 -03:00
9 changed files with 108 additions and 205 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -0,0 +1 @@
<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"> <path d="M41,4H9C6.24,4,4,6.24,4,9v32c0,2.76,2.24,5,5,5h32c2.76,0,5-2.24,5-5V9C46,6.24,43.76,4,41,4z M17,20v19h-6V20H17z M11,14.47c0-1.4,1.2-2.47,3-2.47s2.93,1.07,3,2.47c0,1.4-1.12,2.53-3,2.53C12.2,17,11,15.87,11,14.47z M39,39h-6c0,0,0-9.26,0-10 c0-2-1-4-3.5-4.04h-0.08C27,24.96,26,27.02,26,29c0,0.91,0,10,0,10h-6V20h6v2.56c0,0,1.93-2.56,5.81-2.56 c3.97,0,7.19,2.73,7.19,8.26V39z"/></svg>

After

Width:  |  Height:  |  Size: 501 B

View File

@@ -9,8 +9,7 @@
padding: 2rem; padding: 2rem;
height: fit-content; height: fit-content;
min-height: 100vh; min-height: 100vh;
background-image: url( './bg.svg' ); background: radial-gradient(ellipse at 50% -50%, rgba(49, 46, 129, 1) 60%, rgba(24, 30, 42, 1) 80%);
background-size: cover;
font-weight: normal; font-weight: normal;
} }

View File

@@ -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",

View File

@@ -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);

View File

@@ -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");

View File

@@ -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>

View File

@@ -5,9 +5,8 @@ import { ref } from "vue";
import { onClickOutside } from "@vueuse/core"; import { onClickOutside } from "@vueuse/core";
import { NetworkEnum } from "@/model/NetworkEnum"; import { NetworkEnum } from "@/model/NetworkEnum";
import { connectProvider, requestNetworkChange } from "@/blockchain/provider"; import { connectProvider, requestNetworkChange } from "@/blockchain/provider";
import ethereumImage from "@/assets/ethereum.svg";
import polygonImage from "@/assets/polygon.svg"; const images = import.meta.glob<string>('@/assets/*.{png,svg}', { eager:true, query:'?url', import: 'default'} );
import rootstockImage from "@/assets/rootstock.svg";
// Store reference // Store reference
const etherStore = useEtherStore(); const etherStore = useEtherStore();
@@ -56,14 +55,8 @@ const networkChange = async (network: NetworkEnum): Promise<void> => {
}; };
const getNetworkImage = (networkName: NetworkEnum): string => { const getNetworkImage = (networkName: NetworkEnum): string => {
let validImages = { const path = Object.keys(images).find(key => key.endsWith(`${networkName.toLowerCase()}.svg`));
Ethereum: ethereumImage, return path ? images[path] : '';
Polygon: polygonImage,
Rootstock: rootstockImage,
Localhost: ethereumImage,
};
return validImages[networkName];
}; };
onClickOutside(walletAddressRef, () => { onClickOutside(walletAddressRef, () => {
@@ -134,32 +127,39 @@ onClickOutside(infoMenuRef, () => {
> >
<div class="redirect_button flex mr-4"> <div class="redirect_button flex mr-4">
<div class="mr-6"> <div class="mr-6">
<img <a href="https://www.twitter.com/doiim">
alt="Twitter" <img
width="20" alt="Twitter"
height="20" width="20"
src="@/assets/twitterIcon.svg" height="20"
class="cursor-pointer" src="@/assets/twitterIcon.svg"
onclick="location.href = 'https://www.twitter.com/doiim';" class="cursor-pointer"
/> />
</a>
</div> </div>
<div class="mr-6"> <div class="mr-6">
<img <a href="https://www.linkedin.com/company/doiim/">
alt="Discord" <img
width="20" alt="LinkedIn"
height="20" width="20"
src="@/assets/discordIcon.svg" height="20"
class="cursor-pointer" src="@/assets/linkedinIcon.svg"
/> class="cursor-pointer"
href="https://www.linkedin.com/company/doiim/"
/>
</a>
</div>
<div class="mr-6">
<a href="https://www.github.com/doiim">
<img
alt="Github"
width="20"
height="20"
src="@/assets/githubIcon.svg"
class="cursor-pointer"
/>
</a>
</div> </div>
<img
alt="Github"
width="20"
height="20"
src="@/assets/githubIcon.svg"
class="cursor-pointer"
onclick="location.href = 'https://github.com/doiim';"
/>
</div> </div>
</div> </div>
<div class="w-full flex justify-center"> <div class="w-full flex justify-center">
@@ -273,52 +273,19 @@ onClickOutside(infoMenuRef, () => {
> >
<div class="mt-2"> <div class="mt-2">
<div class="bg-white rounded-md z-10"> <div class="bg-white rounded-md z-10">
<div <div
v-for="network in NetworkEnum"
class="menu-button gap-2 px-4 rounded-md cursor-pointer" class="menu-button gap-2 px-4 rounded-md cursor-pointer"
@click="networkChange(NetworkEnum.rootstock)" @click="networkChange(network)"
> >
<img <img
alt="Rootstock image" :alt="network + ' image'"
width="20" width="20"
height="20" height="20"
src="@/assets/rootstock.svg" :src="getNetworkImage(network)"
/> />
<span class="text-gray-900 py-4 text-end font-semibold text-sm"> <span class="text-gray-900 py-4 text-end font-semibold text-sm">
Rootstock {{ network }}
</span>
</div>
<div class="w-full flex justify-center">
<hr class="w-4/5" />
</div>
<div
class="menu-button gap-2 px-4 rounded-md cursor-pointer"
@click="networkChange(NetworkEnum.ethereum)"
>
<img
alt="Ethereum image"
width="20"
height="20"
src="@/assets/ethereum.svg"
/>
<span class="text-gray-900 py-4 text-end font-semibold text-sm">
Ethereum
</span>
</div>
<div class="w-full flex justify-center">
<hr class="w-4/5" />
</div>
<div
class="menu-button gap-2 px-4 rounded-md cursor-pointer"
@click="networkChange(NetworkEnum.polygon)"
>
<img
alt="Polygon image"
width="20"
height="20"
src="@/assets/polygon.svg"
/>
<span class="text-gray-900 py-4 text-end font-semibold text-sm">
Polygon
</span> </span>
</div> </div>
<div class="w-full flex justify-center"> <div class="w-full flex justify-center">
@@ -456,28 +423,33 @@ onClickOutside(infoMenuRef, () => {
</div> </div>
<div class="menu-button pb-10"> <div class="menu-button pb-10">
<div class="redirect_button flex"> <div class="redirect_button flex">
<img <a href="https://www.twitter.com/doiim/">
alt="Twitter" <img
width="20" alt="Twitter"
height="20" width="20"
src="@/assets/twitterIcon.svg" height="20"
class="mr-6" src="@/assets/twitterIcon.svg"
onclick="location.href = 'https://www.twitter.com/doiim';" class="mr-6"
/> onclick="location.href = 'https://www.twitter.com/doiim';"
<img />
alt="Discord" </a>
width="20" <a href="https://www.linkedin.com/company/doiim/">
height="20" <img
src="@/assets/discordIcon.svg" alt="LinkedIn"
class="mr-6" width="20"
/> height="20"
<img src="@/assets/linkedinIcon.svg"
alt="Github" class="mr-6"
width="20" />
height="20" </a>
src="@/assets/githubIcon.svg" <a href="https://github.com/doiim/">
onclick="location.href = 'https://github.com/doiim';" <img
/> alt="Github"
width="20"
height="20"
src="@/assets/githubIcon.svg"
/>
</a>
</div> </div>
</div> </div>
</div> </div>
@@ -490,56 +462,21 @@ onClickOutside(infoMenuRef, () => {
<div class="pl-4 mt-2 h-full"> <div class="pl-4 mt-2 h-full">
<div class="bg-white rounded-md z-10 h-full"> <div class="bg-white rounded-md z-10 h-full">
<div <div
v-for="network in NetworkEnum"
class="menu-button gap-2 sm:px-4 rounded-md cursor-pointer py-2" class="menu-button gap-2 sm:px-4 rounded-md cursor-pointer py-2"
@click="networkChange(NetworkEnum.rootstock)" @click="networkChange(network)"
> >
<img <img
alt="Rootstock image" :alt="network + 'image'"
width="20" width="20"
height="20" height="20"
src="@/assets/rootstock.svg" :src="getNetworkImage(network)"
/>
/>
<span class="text-gray-900 py-4 text-end font-bold text-sm"> <span class="text-gray-900 py-4 text-end font-bold text-sm">
Rootstock {{ network }}
</span> </span>
</div> </div>
<div class="w-full flex justify-center pb-12">
<hr class="w-4/5" />
</div>
<div
class="menu-button gap-2 sm:px-4 rounded-md cursor-pointer py-2"
@click="networkChange(NetworkEnum.ethereum)"
>
<img
alt="Ethereum image"
width="20"
height="20"
src="@/assets/ethereum.svg"
/>
<span class="text-gray-900 py-4 text-end font-bold text-sm">
Ethereum
</span>
</div>
<div class="w-full flex justify-center">
<hr class="w-4/5" />
</div>
<div
class="menu-button gap-2 sm:px-4 rounded-md cursor-pointer py-2"
@click="networkChange(NetworkEnum.polygon)"
>
<img
alt="Polygon image"
width="20"
height="20"
src="@/assets/polygon.svg"
/>
<span class="text-gray-900 py-4 text-end font-bold text-sm">
Polygon
</span>
</div>
<div class="w-full flex justify-center pb-12">
<hr class="w-4/5" />
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -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;