Merge pull request #34 from liftlearning/p2pix-V2

P2pix v2
This commit is contained in:
Ronyell Henrique authored and GitHub committed 2023-02-06 21:16:16 -03:00
commit 3177aaece9
34 files changed
+553 -274

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
VITE_API_URL=http://localhost:8000/
VITE_GOERLI_API_URL={GOERLI_API_URL_ALCHEMY}
VITE_MUMBAI_API_URL={MUMBAI_API_URL_ALCHEMY}
+6 -12
View File
@@ -33,7 +33,7 @@ describe("addresses.ts functions", () => {
const etherStore = useEtherStore();
etherStore.setNetworkName(NetworkEnum.ethereum);
expect(getTokenAddress()).toBe(
"0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
"0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00"
);
});
@@ -41,13 +41,13 @@ describe("addresses.ts functions", () => {
const etherStore = useEtherStore();
etherStore.setNetworkName(NetworkEnum.polygon);
expect(getTokenAddress()).toBe(
"0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
"0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29"
);
});
it("getTokenAddress Default", () => {
expect(getTokenAddress()).toBe(
"0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
"0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00"
);
});
@@ -55,7 +55,7 @@ describe("addresses.ts functions", () => {
const etherStore = useEtherStore();
etherStore.setNetworkName(NetworkEnum.ethereum);
expect(getP2PixAddress()).toBe(
"0x5f3EFA9A90532914545CEf527C530658af87e196"
"0xefa5cE4351cda51192509cf8De7d8881ADAE95DD"
);
});
@@ -63,13 +63,13 @@ describe("addresses.ts functions", () => {
const etherStore = useEtherStore();
etherStore.setNetworkName(NetworkEnum.polygon);
expect(getP2PixAddress()).toBe(
"0x5f3EFA9A90532914545CEf527C530658af87e196"
"0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b"
);
});
it("getP2PixAddress Default", () => {
expect(getP2PixAddress()).toBe(
"0x5f3EFA9A90532914545CEf527C530658af87e196"
"0xefa5cE4351cda51192509cf8De7d8881ADAE95DD"
);
});
@@ -102,9 +102,3 @@ describe("addresses.ts functions", () => {
expect(isPossibleNetwork("0x55")).toBe(false);
});
});
describe("addresses.ts Unset Store", () => {
it("getProviderUrl Unset", () => {
expect(getProviderUrl()).toBe(undefined);
});
});
+4 -4
View File
@@ -5,8 +5,8 @@ const getTokenAddress = (): string => {
const etherStore = useEtherStore();
const possibleTokenAddresses: { [key: string]: string } = {
Ethereum: "0x294003F602c321627152c6b7DED3EAb5bEa853Ee",
Polygon: "0x294003F602c321627152c6b7DED3EAb5bEa853Ee",
Ethereum: "0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
Polygon: "0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
};
return possibleTokenAddresses[etherStore.networkName];
@@ -16,8 +16,8 @@ const getP2PixAddress = (): string => {
const etherStore = useEtherStore();
const possibleP2PixAddresses: { [key: string]: string } = {
Ethereum: "0x5f3EFA9A90532914545CEf527C530658af87e196",
Polygon: "0x5f3EFA9A90532914545CEf527C530658af87e196",
Ethereum: "0xefa5cE4351cda51192509cf8De7d8881ADAE95DD",
Polygon: "0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b",
};
return possibleP2PixAddresses[etherStore.networkName];
+13 -8
View File
@@ -9,7 +9,8 @@ import { BigNumber, ethers } from "ethers";
import { parseEther } from "ethers/lib/utils";
const addLock = async (
depositId: BigNumber,
seller: string,
token: string,
amount: number
): Promise<string> => {
const etherStore = useEtherStore();
@@ -17,7 +18,8 @@ const addLock = async (
const p2pContract = getContract();
const lock = await p2pContract.lock(
depositId, // BigNumber
seller,
token,
etherStore.walletAddress, // String "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (Example)
ethers.constants.AddressZero, // String "0x0000000000000000000000000000000000000000"
0,
@@ -29,11 +31,11 @@ const addLock = async (
const lock_rec = await lock.wait();
const [t] = lock_rec.events;
return t.args.lockID;
return String(t.args.lockID);
};
const releaseLock = async (
pixKey: string,
pixKey: number,
amount: number,
e2eId: string,
lockId: string
@@ -43,7 +45,7 @@ const releaseLock = async (
);
const messageToSign = ethers.utils.solidityKeccak256(
["string", "uint256", "bytes32"],
["uint160", "uint256", "bytes32"],
[
pixKey,
parseEther(String(amount)),
@@ -61,7 +63,7 @@ const releaseLock = async (
const p2pContract = new ethers.Contract(getP2PixAddress(), p2pix.abi, signer);
const release = await p2pContract.release(
lockId,
BigNumber.from(lockId),
ethers.constants.AddressZero,
ethers.utils.formatBytes32String(e2eId),
sig.r,
@@ -82,10 +84,13 @@ const cancelDeposit = async (depositId: BigNumber): Promise<any> => {
return cancel;
};
const withdrawDeposit = async (depositId: BigNumber): Promise<any> => {
const withdrawDeposit = async (
depositId: BigNumber,
amount: string
): Promise<any> => {
const contract = getContract();
const withdraw = await contract.withdraw(depositId, []);
const withdraw = await contract.withdraw(depositId, amount, []);
await withdraw.wait();
return withdraw;
+33 -14
View File
@@ -20,19 +20,25 @@ const getNetworksLiquidity = async (): Promise<void> => {
); // mumbai provider
const p2pContractGoerli = new ethers.Contract(
"0x5f3EFA9A90532914545CEf527C530658af87e196",
"0xefa5cE4351cda51192509cf8De7d8881ADAE95DD",
p2pix.abi,
goerliProvider
);
const p2pContractMumbai = new ethers.Contract(
"0x5f3EFA9A90532914545CEf527C530658af87e196",
"0xA9258eBb157E4cf5e756b77FDD0DF09C2F73240b",
p2pix.abi,
mumbaiProvider
);
const depositListGoerli = await getValidDeposits(p2pContractGoerli);
const depositListGoerli = await getValidDeposits(
"0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00",
p2pContractGoerli
);
const depositListMumbai = await getValidDeposits(p2pContractMumbai);
const depositListMumbai = await getValidDeposits(
"0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29",
p2pContractMumbai
);
etherStore.setDepositsValidListGoerli(depositListGoerli);
console.log(depositListGoerli);
@@ -42,6 +48,7 @@ const getNetworksLiquidity = async (): Promise<void> => {
};
const getValidDeposits = async (
token: string,
contract?: Contract
): Promise<ValidDeposit[]> => {
let p2pContract: Contract;
@@ -56,29 +63,41 @@ const getValidDeposits = async (
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
if (!contract) p2pContract = getContract(); // get metamask provider contract
const depositList: { [key: string]: ValidDeposit } = {};
const depositList = await Promise.all(
await Promise.all(
eventsDeposits.map(async (deposit) => {
const mappedDeposit = await p2pContract.mapDeposits(
deposit.args?.depositID
// Get liquidity only for the selected token
if (deposit.args?.token != token) return null;
const mappedBalance = await p2pContract.getBalance(
deposit.args?.seller,
token
);
const mappedPixTarget = await p2pContract.getPixTarget(
deposit.args?.seller,
token
);
let validDeposit: ValidDeposit | null = null;
if (mappedDeposit.valid) {
if (mappedBalance._hex) {
validDeposit = {
token: token,
blockNumber: deposit.blockNumber,
depositID: deposit.args?.depositID,
remaining: Number(formatEther(mappedDeposit.remaining)),
seller: mappedDeposit.seller,
pixKey: mappedDeposit.pixTarget,
remaining: Number(formatEther(mappedBalance._hex)),
seller: deposit.args?.seller,
pixKey: Number(mappedPixTarget._hex),
};
}
return validDeposit;
if (validDeposit)
depositList[deposit.args?.seller + token] = validDeposit;
})
);
return depositList.filter((deposit) => deposit) as ValidDeposit[];
return Object.values(depositList);
};
export { getValidDeposits, getNetworksLiquidity };
+1 -1
View File
@@ -22,7 +22,6 @@ const approveTokens = async (tokenQty: string): Promise<any> => {
);
await apprv.wait();
console.log(apprv);
return apprv;
};
@@ -33,6 +32,7 @@ const addDeposit = async (tokenQty: string, pixKey: string): Promise<any> => {
getTokenAddress(),
parseEther(tokenQty),
pixKey,
true,
ethers.utils.formatBytes32String("")
);
+2 -2
View File
@@ -35,7 +35,7 @@ const updateWalletStatus = async (): Promise<void> => {
const listValidDepositTransactionsByWalletAddress = async (
walletAddress: string
): Promise<ValidDeposit[]> => {
const walletDeposits = await getValidDeposits();
const walletDeposits = await getValidDeposits(getTokenAddress());
if (walletDeposits) {
return walletDeposits
@@ -51,7 +51,7 @@ const listValidDepositTransactionsByWalletAddress = async (
const listAllTransactionByWalletAddress = async (
walletAddress: string
): Promise<Event[]> => {
const p2pContract = getContract();
const p2pContract = getContract(true);
const filterDeposits = p2pContract.filters.DepositAdded([walletAddress]);
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
+8 -7
View File
@@ -1,10 +1,13 @@
<script setup lang="ts">
</script>
<script setup lang="ts"></script>
<template>
<div class="modal-overlay inset-0 fixed justify-center backdrop-blur-sm sm:backdrop-blur-none">
<div
class="modal-overlay inset-0 fixed justify-center backdrop-blur-sm sm:backdrop-blur-none"
>
<div class="modal px-5 text-center">
<p class="text-black tracking-tighter leading-tight my-6 mx-2 text-justify">
<p
class="text-black tracking-tighter leading-tight my-6 mx-2 text-justify"
>
<strong>ATENÇÃO!</strong>
A transação só será processada após inserir o código de autenticação.
Caso contrário não conseguiremos comprovar o seu depósito e não será
@@ -21,7 +24,6 @@
</template>
<style scoped>
.modal-overlay {
display: flex !important;
}
@@ -62,5 +64,4 @@ button {
font-size: 14px;
border-radius: 10px;
}
</style>
</style>
@@ -16,11 +16,17 @@ const etherStore = useEtherStore();
const itemsToShow = ref<(Event | ValidDeposit)[]>([]);
const getExplorer = (): string => {
return etherStore.networkName == NetworkEnum.ethereum
? "Etherscan"
: "Polygonscan";
};
// Methods
const isValidDeposit = (
deposit: Event | ValidDeposit
): deposit is ValidDeposit => {
return (deposit as ValidDeposit).depositID !== undefined;
return (deposit as ValidDeposit).token !== undefined;
};
const showInitialItems = (): void => {
@@ -48,8 +54,8 @@ const getEventName = (event: string | undefined): string => {
const possibleEventName: { [key: string]: string } = {
DepositAdded: "Oferta",
LockAdded: "Compra",
LockReleased: "Reserva",
LockAdded: "Reserva",
LockReleased: "Compra",
};
return possibleEventName[event];
@@ -72,7 +78,7 @@ watch(props, async (): Promise<void> => {
});
//emits
const emit = defineEmits(["cancelDeposit", "withdrawDeposit"]);
const emit = defineEmits(["withdrawDeposit"]);
// initial itemsToShow valueb
showInitialItems();
@@ -109,7 +115,7 @@ showInitialItems();
class="flex gap-2 cursor-pointer items-center justify-self-center"
@click="openEtherscanUrl((item as Event)?.transactionHash)"
>
<span class="last-release-info">Etherscan</span>
<span class="last-release-info">{{ getExplorer() }}</span>
<img alt="Redirect image" src="@/assets/redirect.svg" />
</div>
</div>
@@ -122,19 +128,10 @@ showInitialItems();
<hr class="pb-3" />
<div class="flex justify-between items-center">
<div
class="flex gap-2 cursor-pointer items-center justify-self-center"
@click="
emit('cancelDeposit', (item as ValidDeposit).depositID, index)
"
>
<span class="last-release-info">Cancelar</span>
</div>
<div
class="flex gap-2 cursor-pointer items-center justify-self-center border-2 p-2 border-amber-300 rounded-md"
@click="
emit('withdrawDeposit', (item as ValidDeposit).depositID, index)
emit('withdrawDeposit', (item as ValidDeposit).token, index)
"
>
<img alt="Withdraw image" src="@/assets/withdraw.svg" />
@@ -10,6 +10,17 @@ describe("ListingComponent.vue", () => {
setActivePinia(createPinia());
});
test("Test Message when an empty array is received", () => {
const wrapper = mount(ListingComponent, {
props: {
walletTransactions: [],
isManageMode: true,
},
});
expect(wrapper.html()).toContain("Não há nenhuma transação anterior");
});
test("Test Headers on List in Manage Mode", () => {
const wrapper = mount(ListingComponent, {
props: {
@@ -20,7 +31,6 @@ describe("ListingComponent.vue", () => {
expect(wrapper.html()).toContain("Valor");
expect(wrapper.html()).toContain("Data");
expect(wrapper.html()).toContain("Cancelar oferta");
expect(wrapper.html()).toContain("Retirar tokens");
});
@@ -70,20 +80,6 @@ describe("ListingComponent.vue", () => {
expect(elements).toHaveLength(5);
});
test("Test cancel offer button emit", async () => {
const wrapper = mount(ListingComponent, {
props: {
walletTransactions: MockValidDeposits,
isManageMode: true,
},
});
wrapper.vm.$emit("cancelDeposit");
await wrapper.vm.$nextTick();
expect(wrapper.emitted("cancelDeposit")).toBeTruthy();
});
test("Test withdraw offer button emit", async () => {
const wrapper = mount(ListingComponent, {
props: {
@@ -0,0 +1,27 @@
import { mount } from "@vue/test-utils";
import LoadingComponent from "../LoadingComponent.vue";
describe("Loading.vue", () => {
test("Test loading content with received props", () => {
const wrapper = mount(LoadingComponent, {
props: {
title: "MockTitle",
message: "MockMessage",
},
});
expect(wrapper.html()).toContain("MockTitle");
expect(wrapper.html()).toContain("MockMessage");
});
test("Test default text if props title isnt passed", () => {
const wrapper = mount(LoadingComponent, {
props: {
message: "MockMessage",
},
});
expect(wrapper.html()).toContain("Confirme em sua carteira");
expect(wrapper.html()).toContain("MockMessage");
});
});
+1 -4
View File
@@ -154,10 +154,7 @@ const validatePix = async (): Promise<void> => {
@button-clicked="emit('pixValidated', e2eId)"
/>
</div>
<CustomModal
v-if="showModal"
@close-modal="showModal = false"
/>
<CustomModal v-if="showModal" @close-modal="showModal = false" />
</div>
</template>
+8 -1
View File
@@ -107,8 +107,13 @@ const enableOrDisableConfirmButton = (): void => {
};
watch(networkName, (): void => {
verifyLiquidity();
enableOrDisableConfirmButton();
});
watch(walletAddress, (): void => {
verifyLiquidity();
});
</script>
<template>
@@ -149,7 +154,9 @@ watch(networkName, (): void => {
class="sm:w-fit w-4"
src="@/assets/brz.svg"
/>
<span class="text-gray-900 sm:text-lg text-md w-fit" id="brz">BRZ</span>
<span class="text-gray-900 sm:text-lg text-md w-fit" id="brz"
>BRZ</span
>
</div>
</div>
+4 -2
View File
@@ -14,10 +14,12 @@ const props = defineProps({
<template>
<div class="page">
<div class="text-container">
<span class="text font-extrabold sm:text-5xl text-xl sm:max-w-[50rem] max-w-[20rem]"
<span
class="text font-extrabold sm:text-5xl text-xl sm:max-w-[50rem] max-w-[20rem]"
>Envie sua oferta para a rede
</span>
<span class="text text-xl font-normal sm:text-base text-xs sm:max-w-[30rem] max-w-[22rem]"
<span
class="text text-xl font-normal sm:text-base text-xs sm:max-w-[30rem] max-w-[22rem]"
>Após a confirmação sua oferta estará disponível para outros usuários.
Caso deseje retirar a oferta, será necessário aguardar 24h para receber
os tokens de volta.</span
@@ -3,6 +3,7 @@ import { ref } from "vue";
import CustomButton from "../CustomButton/CustomButton.vue";
import { debounce } from "@/utils/debounce";
import { decimalCount } from "@/utils/decimalCount";
import { pixFormatValidation, postProcessKey } from "@/utils/pixKeyFormat";
import { useEtherStore } from "@/store/ether";
import { storeToRefs } from "pinia";
import { connectProvider } from "@/blockchain/provider";
@@ -17,6 +18,7 @@ const pixKey = ref<string>("");
const enableSelectButton = ref<boolean>(false);
const hasLiquidity = ref<boolean>(true);
const validDecimals = ref<boolean>(true);
const validPixFormat = ref<boolean>(true);
// Emits
const emit = defineEmits(["approveTokens"]);
@@ -35,10 +37,26 @@ const handleInputEvent = (event: any): void => {
validDecimals.value = true;
};
const handlePixKeyInputEvent = (event: any): void => {
const { value } = event.target;
pixKey.value = value;
if (pixFormatValidation(pixKey.value)) {
validPixFormat.value = true;
enableSelectButton.value = true;
return;
}
enableSelectButton.value = false;
validPixFormat.value = false;
};
const handleButtonClick = async (
offer: string,
pixKey: string
): Promise<void> => {
console.log(postProcessKey(pixKey));
if (walletAddress.value) emit("approveTokens", { offer, pixKey });
else await connectProvider();
};
@@ -47,10 +65,12 @@ const handleButtonClick = async (
<template>
<div class="page w-full">
<div class="text-container">
<span class="text font-extrabold sm:text-5xl text-3xl sm:max-w-[29rem] max-w-[20rem]"
<span
class="text font-extrabold sm:text-5xl text-3xl sm:max-w-[29rem] max-w-[20rem]"
>Venda cripto e receba em Pix</span
>
<span class="text font-medium sm:text-base text-xs sm:max-w-[28rem] max-w-[30rem] sm:tracking-normal tracking-wide"
<span
class="text font-medium sm:text-base text-xs sm:max-w-[28rem] max-w-[30rem] sm:tracking-normal tracking-wide"
>Digite sua oferta, informe a chave Pix, selecione a rede, aprove o
envio da transação e confirme sua oferta.</span
>
@@ -81,9 +101,7 @@ const handleButtonClick = async (
class="sm:w-fit w-4"
src="@/assets/brz.svg"
/>
<span class="text-gray-900 w-fit" id="brz">
BRZ
</span>
<span class="text-gray-900 w-fit" id="brz"> BRZ </span>
</div>
</div>
@@ -103,15 +121,22 @@ const handleButtonClick = async (
>
<div class="flex justify-between w-full items-center">
<input
@input="debounce(handlePixKeyInputEvent, 500)($event)"
type="text"
v-model="pixKey"
class="border-none outline-none sm:text-lg text-sm text-gray-900 w-fit"
placeholder="Digite a chave Pix"
/>
</div>
<div class="flex pt-2 justify-center" v-if="!validPixFormat">
<span class="text-red-500 font-normal text-sm"
>Por favor utilize telefone, CPF ou CNPJ</span
>
</div>
</div>
<CustomButton
:text="walletAddress ? 'Aprovar tokens' : 'Conectar Carteira'"
:isDisabled="!validDecimals || !validPixFormat"
@buttonClicked="handleButtonClick(offer, pixKey)"
/>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useEtherStore } from "@/store/ether";
import { ref, onBeforeUnmount, onMounted } from "vue";
import { ref } from "vue";
import { onClickOutside } from "@vueuse/core";
import { NetworkEnum } from "@/model/NetworkEnum";
import { connectProvider, requestNetworkChange } from "@/blockchain/provider";
+2 -5
View File
@@ -1,11 +1,8 @@
import type { BigNumber } from "ethers";
export type ValidDeposit = {
depositID: BigNumber;
token: string;
blockNumber: number;
remaining: number;
seller: string;
pixKey: string;
pixTarget?: string;
pixKey: number;
open?: boolean;
};
+10 -11
View File
@@ -1,40 +1,39 @@
import { parseEther } from "ethers/lib/utils";
import type { ValidDeposit } from "../ValidDeposit";
export const MockValidDeposits: ValidDeposit[] = [
{
blockNumber: 1,
depositID: parseEther("1"),
token: "1",
remaining: 70,
seller: "mockedSellerAddress",
pixKey: "123456789",
pixKey: 123456789,
},
{
blockNumber: 2,
depositID: parseEther("2"),
token: "2",
remaining: 200,
seller: "mockedSellerAddress",
pixKey: "123456789",
pixKey: 123456789,
},
{
blockNumber: 3,
depositID: parseEther("3"),
token: "3",
remaining: 1250,
seller: "mockedSellerAddress",
pixKey: "123456789",
pixKey: 123456789,
},
{
blockNumber: 4,
depositID: parseEther("4"),
token: "4",
remaining: 4000,
seller: "mockedSellerAddress",
pixKey: "123456789",
pixKey: 123456789,
},
{
blockNumber: 5,
depositID: parseEther("5"),
token: "5",
remaining: 2000,
seller: "mockedSellerAddress",
pixKey: "123456789",
pixKey: 123456789,
},
];
+24
View File
@@ -0,0 +1,24 @@
import { it, expect, vi, type Mock } from "vitest";
import { debounce } from "../debounce";
vi.useFakeTimers();
describe("debounce function test", () => {
let mockFunction: Mock;
let debounceFunction: Function;
beforeEach(() => {
mockFunction = vi.fn();
debounceFunction = debounce(mockFunction, 1000);
});
it("debounce function will be executed just once", () => {
for (let i = 0; i < 100; i++) {
debounceFunction();
}
vi.runAllTimers();
expect(mockFunction).toBeCalledTimes(1);
});
});
+12
View File
@@ -0,0 +1,12 @@
import { it, expect } from "vitest";
import { decimalCount } from "../decimalCount";
describe("decimalCount function test", () => {
it("decimalCount should return length 1 of decimal", () => {
expect(decimalCount("4.1")).toEqual(1);
});
it("decimalCount should return length 0 because no decimal found", () => {
expect(decimalCount("5")).toEqual(0);
});
});
@@ -0,0 +1,25 @@
import { MockValidDeposits } from "@/model/mock/ValidDepositMock";
import { it, expect, vi } from "vitest";
import { verifyNetworkLiquidity } from "../networkLiquidity";
vi.useFakeTimers();
describe("verifyNetworkLiquidity function test", () => {
it("verifyNetworkLiquidity should return an element from valid deposit list when searching for other deposits", () => {
const liquidityElement = verifyNetworkLiquidity(
MockValidDeposits[0].remaining,
"strangeWalletAddress",
MockValidDeposits
);
expect(liquidityElement).toEqual(MockValidDeposits[0]);
});
it("verifyNetworkLiquidity should return undefined when all deposits on valid deposit list match connected wallet addres", () => {
const liquidityElement = verifyNetworkLiquidity(
MockValidDeposits[0].remaining,
MockValidDeposits[0].seller,
[MockValidDeposits[0]]
);
expect(liquidityElement).toEqual(undefined);
});
});
+16
View File
@@ -0,0 +1,16 @@
export const pixFormatValidation = (pixKey: string): boolean => {
const cpf = /(^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$)/g;
const cnpj = /(^\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}$)/g;
const telefone = /(^[0-9]{2})?(\s|-)?(9?[0-9]{4})-?([0-9]{4}$)/g;
if (pixKey.match(cpf) || pixKey.match(cnpj) || pixKey.match(telefone)) {
return true;
}
return false;
};
export const postProcessKey = (pixKey: string): string => {
pixKey = pixKey.replace(/[-.()/]/g, "");
return pixKey;
};
@@ -330,8 +330,8 @@
"type": "function"
}
],
"bytecode": "0x60e06040523480156200001157600080fd5b50604051620010bf380380620010bf833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610cf4620003cb60003960006104630152600061042e015260006101540152610cf46000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906108fc565b60405180910390f35b61011561011036600461096d565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610997565b610338565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e61042a565b61012e61019e3660046109d3565b60036020526000908152604090205481565b61012e6101be3660046109d3565b60056020526000908152604090205481565b6100ec610485565b6101156101e636600461096d565b610492565b6101fe6101f93660046109f5565b61050a565b005b61012e61020e366004610a68565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610ab1565b6107b1565b6000805461024b90610b7c565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610b7c565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103279086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146103945761036f8382610bcd565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906103bc908490610bcd565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104179087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104605761045b6107f7565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610b7c565b336000908152600360205260408120805483919083906104b3908490610bcd565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103279086815260200190565b42841015610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000600161058561042a565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a08301939093Line truncated
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906108fc565b60405180910390f35b61011561011036600461096d565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610997565b610338565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e61042a565b61012e61019e3660046109d3565b60036020526000908152604090205481565b61012e6101be3660046109d3565b60056020526000908152604090205481565b6100ec610485565b6101156101e636600461096d565b610492565b6101fe6101f93660046109f5565b61050a565b005b61012e61020e366004610a68565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610ab1565b6107b1565b6000805461024b90610b7c565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610b7c565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103279086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146103945761036f8382610bcd565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906103bc908490610bcd565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104179087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104605761045b6107f7565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610b7c565b336000908152600360205260408120805483919083906104b3908490610bcd565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103279086815260200190565b42841015610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000600161058561042a565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f19010000000000000000000000000000000000000000000000000000000000006101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156106ac573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906106e25750876001600160a01b0316816001600160a01b0316145b610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401610570565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156107f1576107e18482815181106107d3576107d3610be4565b602002602001015184610891565b6107ea81610bfa565b90506107b6565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516108299190610c15565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546108a39190610ccf565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156109295785810183015185820160400152820161090d565b8181111561093b576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461096857600080fd5b919050565b6000806040838503121561098057600080fd5b61098983610951565b946020939093013593505050565b6000806000606084860312156109ac57600080fd5b6109b584610951565b92Line truncated
"bytecode": "0x60e06040523480156200001157600080fd5b506040516200129938038062001299833981016040819052620000349162000279565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b908401528151919291601291620000839160009190620001d3565b50815162000099906001906020850190620001d3565b5060ff81166080524660a052620000af620000ca565b60c05250620000c391503390508262000166565b506200039b565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000fe9190620002d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b80600260008282546200017a919062000374565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001e19062000293565b90600052602060002090601f01602090048101928262000205576000855562000250565b82601f106200022057805160ff191683800117855562000250565b8280016001018555821562000250579182015b828111156200025057825182559160200191906001019062000233565b506200025e92915062000262565b5090565b5b808211156200025e576000815560010162000263565b6000602082840312156200028c57600080fd5b5051919050565b600181811c90821680620002a857607f821691505b60208210811415620002ca57634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c915080831680620002ed57607f831692505b60208084108214156200030e57634e487b7160e01b86526022600452602486fd5b818015620003255760018114620003375762000366565b60ff1986168952848901965062000366565b60008a81526020902060005b868110156200035e5781548b82015290850190830162000343565b505084890196505b509498975050505050505050565b600082198211156200039657634e487b7160e01b600052601160045260246000fd5b500190565b60805160a05160c051610ece620003cb60003960006104c20152600061048d015260006101540152610ece6000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906109f2565b60405180910390f35b610115610110366004610a8e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610ab8565b610345565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e610489565b61012e61019e366004610af4565b60036020526000908152604090205481565b61012e6101be366004610af4565b60056020526000908152604090205481565b6100ec6104e4565b6101156101e6366004610a8e565b6104f1565b6101fe6101f9366004610b16565b610576565b005b61012e61020e366004610b89565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610beb565b61089a565b6000805461024b90610cd4565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610cd4565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103349086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103d9576103a78382610d57565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85166000908152600360205260408120805485929061040e908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104769087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104bf576104ba6108e0565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610cd4565b33600090815260036020526040812080548391908390610512908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103349086815260200190565b428410156105e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b600060016105f1610489Line truncated
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb146101d8578063d505accf146101eb578063dd62ed3e14610200578063ea66696c1461022b57600080fd5b806370a08231146101905780637ecebe00146101b057806395d89b41146101d057600080fd5b806323b872dd116100bd57806323b872dd1461013c578063313ce5671461014f5780633644e5151461018857600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f991906109f2565b60405180910390f35b610115610110366004610a8e565b6102cc565b60405190151581526020016100f9565b61012e60025481565b6040519081526020016100f9565b61011561014a366004610ab8565b610345565b6101767f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100f9565b61012e610489565b61012e61019e366004610af4565b60036020526000908152604090205481565b61012e6101be366004610af4565b60056020526000908152604090205481565b6100ec6104e4565b6101156101e6366004610a8e565b6104f1565b6101fe6101f9366004610b16565b610576565b005b61012e61020e366004610b89565b600460209081526000928352604080842090915290825290205481565b6101fe610239366004610beb565b61089a565b6000805461024b90610cd4565b80601f016020809104026020016040519081016040528092919081815260200182805461027790610cd4565b80156102c45780601f10610299576101008083540402835291602001916102c4565b820191906000526020600020905b8154815290600101906020018083116102a757829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103349086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146103d9576103a78382610d57565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff85166000908152600360205260408120805485929061040e908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104769087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146104bf576104ba6108e0565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001805461024b90610cd4565b33600090815260036020526040812080548391908390610512908490610d57565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103349086815260200190565b428410156105e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b600060016105f1610489565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610743573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906107be57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016105dc565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b815160005b818110156108da576108ca8482815181106108bc576108bc610d6e565b60200260200101518461097a565b6108d381610d9d565b905061089f565b50505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516109129190610dd6565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b806002600082825461098c9190610ea9565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040Line truncated
"linkReferences": {},
"deployedLinkReferences": {}
}
+259 -110
View File
@@ -49,11 +49,21 @@
"name": "AmountNotAllowed",
"type": "error"
},
{
"inputs": [],
"name": "DecOverflow",
"type": "error"
},
{
"inputs": [],
"name": "DepositAlreadyExists",
"type": "error"
},
{
"inputs": [],
"name": "EmptyPixTarget",
"type": "error"
},
{
"inputs": [],
"name": "InvalidDeposit",
@@ -79,6 +89,11 @@
"name": "LoopOverflow",
"type": "error"
},
{
"inputs": [],
"name": "MaxBalExceeded",
"type": "error"
},
{
"inputs": [],
"name": "NoTokens",
@@ -94,6 +109,11 @@
"name": "NotExpired",
"type": "error"
},
{
"inputs": [],
"name": "NotInitialized",
"type": "error"
},
{
"inputs": [],
"name": "OnlySeller",
@@ -147,12 +167,6 @@
"name": "seller",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "depositID",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
@@ -180,29 +194,10 @@
},
{
"indexed": false,
"internalType": "uint256",
"name": "depositID",
"type": "uint256"
}
],
"name": "DepositClosed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "seller",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "depositID",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
@@ -243,14 +238,14 @@
},
{
"indexed": true,
"internalType": "bytes32",
"internalType": "uint256",
"name": "lockID",
"type": "bytes32"
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "depositID",
"name": "seller",
"type": "uint256"
},
{
@@ -287,9 +282,9 @@
},
{
"indexed": false,
"internalType": "bytes32",
"internalType": "uint256",
"name": "lockId",
"type": "bytes32"
"type": "uint256"
},
{
"indexed": false,
@@ -312,9 +307,9 @@
},
{
"indexed": false,
"internalType": "bytes32",
"internalType": "uint256",
"name": "lockId",
"type": "bytes32"
"type": "uint256"
}
],
"name": "LockReturned",
@@ -371,6 +366,31 @@
"name": "RootUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "state",
"type": "bool"
}
],
"name": "ValidSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
@@ -416,6 +436,25 @@
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_key",
"type": "uint256"
}
],
"name": "_castKeyToAddr",
"outputs": [
{
"internalType": "address",
"name": "_addr",
"type": "address"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
@@ -435,19 +474,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "depositID",
"type": "uint256"
}
],
"name": "cancelDeposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "defaultLockBlocks",
@@ -469,14 +495,19 @@
"type": "address"
},
{
"internalType": "uint256",
"internalType": "uint96",
"name": "_amount",
"type": "uint256"
"type": "uint96"
},
{
"internalType": "string",
"internalType": "uint160",
"name": "_pixTarget",
"type": "string"
"type": "uint160"
},
{
"internalType": "bool",
"name": "_valid",
"type": "bool"
},
{
"internalType": "bytes32",
@@ -485,23 +516,28 @@
}
],
"name": "deposit",
"outputs": [
{
"internalType": "uint256",
"name": "depositID",
"type": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "depositCount",
"inputs": [
{
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
}
],
"name": "getBalance",
"outputs": [
{
"internalType": "uint256",
"name": "_val",
"name": "bal",
"type": "uint256"
}
],
@@ -511,9 +547,86 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "_depositID",
"type": "uint256"
"internalType": "address[]",
"name": "sellers",
"type": "address[]"
},
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
}
],
"name": "getBalances",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
}
],
"name": "getPixTarget",
"outputs": [
{
"internalType": "uint160",
"name": "pixTarget",
"type": "uint160"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
}
],
"name": "getValid",
"outputs": [
{
"internalType": "bool",
"name": "valid",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_seller",
"type": "address"
},
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
@@ -541,56 +654,30 @@
"type": "bytes32[]"
},
{
"internalType": "bytes32[]",
"internalType": "uint256[]",
"name": "expiredLocks",
"type": "bytes32[]"
"type": "uint256[]"
}
],
"name": "lock",
"outputs": [
{
"internalType": "bytes32",
"name": "lockID",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "mapDeposits",
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "lockCounter",
"outputs": [
{
"internalType": "uint256",
"name": "remaining",
"name": "",
"type": "uint256"
},
{
"internalType": "string",
"name": "pixTarget",
"type": "string"
},
{
"internalType": "address",
"name": "seller",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "bool",
"name": "valid",
"type": "bool"
}
],
"stateMutability": "view",
@@ -599,16 +686,21 @@
{
"inputs": [
{
"internalType": "bytes32",
"internalType": "uint256",
"name": "",
"type": "bytes32"
"type": "uint256"
}
],
"name": "mapLocks",
"outputs": [
{
"internalType": "uint256",
"name": "depositID",
"name": "sellerKey",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "counter",
"type": "uint256"
},
{
@@ -626,6 +718,11 @@
"name": "expirationBlock",
"type": "uint256"
},
{
"internalType": "uint160",
"name": "pixTarget",
"type": "uint160"
},
{
"internalType": "address",
"name": "buyerAddress",
@@ -640,6 +737,11 @@
"internalType": "address",
"name": "relayerAddress",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"stateMutability": "view",
@@ -661,9 +763,9 @@
{
"inputs": [
{
"internalType": "bytes32",
"internalType": "uint256",
"name": "lockID",
"type": "bytes32"
"type": "uint256"
},
{
"internalType": "address",
@@ -728,6 +830,30 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "contract ERC20",
"name": "",
"type": "address"
}
],
"name": "sellerBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@@ -798,6 +924,24 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
},
{
"internalType": "bool",
"name": "state",
"type": "bool"
}
],
"name": "setValidState",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
@@ -819,9 +963,9 @@
{
"inputs": [
{
"internalType": "bytes32[]",
"internalType": "uint256[]",
"name": "lockIDs",
"type": "bytes32[]"
"type": "uint256[]"
}
],
"name": "unlockExpired",
@@ -888,15 +1032,20 @@
},
{
"inputs": [
{
"internalType": "contract ERC20",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "depositID",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bytes32[]",
"internalType": "uint256[]",
"name": "expiredLocks",
"type": "bytes32[]"
"type": "uint256[]"
}
],
"name": "withdraw",
@@ -916,8 +1065,8 @@
"type": "receive"
}
],
"bytecode": "0x60806040526001805560405162002a9a38038062002a9a8339810160408190526200002a916200049d565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000620565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806004557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005bb565b60200260200101516200038760201b60201c565b6000908152600660205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005d1565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083016020830282015b8083146200037f578251600052600b60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b611000600160ac1b031690565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003d857620003d862000397565b604052919050565b60006001600160401b03821115620003fc57620003fc62000397565b5060051b60200190565b6001600160a01b03811681146200041c57600080fd5b50565b600082601f8301126200043157600080fd5b815160206200044a6200044483620003e0565b620003ad565b82815260059290921b840181019181810190868411156200046a57600080fd5b8286015b8481101562000492578051620004848162000406565b83529183019183016200046e565b509695505050505050565b600080600080600060a08688031215620004b657600080fd5b8551602080880151919650906001600160401b0380821115620004d857600080fd5b620004e68a838b016200041f565b965060408901519150620004fa8262000406565b6060890151919550808211156200051057600080fd5b6200051e8a838b016200041f565b945060808901519150808211156200053557600080fd5b508701601f810189136200054857600080fd5b8051620005596200044482620003e0565b81815260059190911b8201830190838101908b8311156200057957600080fd5b928401925b82841015620005a95783518015158114620005995760008081fd5b825292840192908401906200057e565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015620006145783516001600160a01b031683529284019291840191600101620005ed565b50909695505050505050565b61246a80620006306000396000f3fe6080604052600436106101a55760003560e01c806372fada5c116100e15780638e2749d61161008a57806398a268711161006457806398a268711461056b578063c52164c61461059b578063d6e8b973146105bb578063f7d0e04b146105db57600080fd5b80638e2749d6146105045780638e2a3d36146105245780639872dbfe1461055557600080fd5b80637f94f65d116100bb5780637f94f65d1461048c5780638652b37e146104ac5780638da5cb5b146104cc57600080fd5b806372fada5c1461041f578063758d77d41461043f57806377cd38a41461045f57600080fd5b8063363179721161014e578063574983c811610128578063574983c81461039e5780635fd8c710146103be57806369cc6af4146103d35780636a1460241461040357600080fd5b80633631797214610313578063461f3120146103335780634b2ae9801461037357600080fd5b806316d722401161017f57806316d722401461023357806329cc7d10146102dc5780632dfdf0b5146102fc57600080fd5b806304937320146101b15780630d2a2d44146101f157806313af40351461021357600080fd5b366101ac57005b600080fd5b3480156101bd57600080fd5b506101de6101cc366004611d07565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611e14565b6105fb565b005b34801561021f57600080fd5b5061021161022e366004611e51565b6106ec565b34801561023f57600080fd5b5061029861024e366004611d07565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101e8565b3480156102e857600080fd5b506101de6102f7366004611e6e565b61078d565b34801561030857600080fd5b506003546101de9081565b34801561031f57600080fd5b5061021161032e366004611f4b565b610991565b34801561033f57600080fd5b5061036361034e366004611d07565b60096020526000908152604090205460ff1681565b60405190151581526020016101e8565b34801561037f57600080fd5b506101de61038e36600461Line truncated
"deployedBytecode": "0x6080604052600436106101a55760003560e01c806372fada5c116100e15780638e2749d61161008a57806398a268711161006457806398a268711461056b578063c52164c61461059b578063d6e8b973146105bb578063f7d0e04b146105db57600080fd5b80638e2749d6146105045780638e2a3d36146105245780639872dbfe1461055557600080fd5b80637f94f65d116100bb5780637f94f65d1461048c5780638652b37e146104ac5780638da5cb5b146104cc57600080fd5b806372fada5c1461041f578063758d77d41461043f57806377cd38a41461045f57600080fd5b8063363179721161014e578063574983c811610128578063574983c81461039e5780635fd8c710146103be57806369cc6af4146103d35780636a1460241461040357600080fd5b80633631797214610313578063461f3120146103335780634b2ae9801461037357600080fd5b806316d722401161017f57806316d722401461023357806329cc7d10146102dc5780632dfdf0b5146102fc57600080fd5b806304937320146101b15780630d2a2d44146101f157806313af40351461021357600080fd5b366101ac57005b600080fd5b3480156101bd57600080fd5b506101de6101cc366004611d07565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004611e14565b6105fb565b005b34801561021f57600080fd5b5061021161022e366004611e51565b6106ec565b34801561023f57600080fd5b5061029861024e366004611d07565b600860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391926001600160a01b03918216928216911687565b6040805197885260208801969096529486019390935260608501919091526001600160a01b03908116608085015290811660a08401521660c082015260e0016101e8565b3480156102e857600080fd5b506101de6102f7366004611e6e565b61078d565b34801561030857600080fd5b506003546101de9081565b34801561031f57600080fd5b5061021161032e366004611f4b565b610991565b34801561033f57600080fd5b5061036361034e366004611d07565b60096020526000908152604090205460ff1681565b60405190151581526020016101e8565b34801561037f57600080fd5b506101de61038e366004611e51565b600c1b611000600160ac1b031690565b3480156103aa57600080fd5b506102116103b9366004611d07565b610a51565b3480156103ca57600080fd5b50610211610acf565b3480156103df57600080fd5b506103636103ee366004611e51565b600b6020526000908152604090205460ff1681565b34801561040f57600080fd5b506101de670de0b6b3a764000081565b34801561042b57600080fd5b5061021161043a366004611d07565b610b59565b34801561044b57600080fd5b5061021161045a366004611f97565b610be1565b34801561046b57600080fd5b506101de61047a366004611d07565b600a6020526000908152604090205481565b34801561049857600080fd5b506102116104a7366004611ffb565b61103a565b3480156104b857600080fd5b506101de6104c7366004612027565b6110e6565b3480156104d857600080fd5b506000546104ec906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561051057600080fd5b5061021161051f3660046120db565b611311565b34801561053057600080fd5b5061054461053f366004611d07565b611479565b6040516101e895949392919061211d565b34801561056157600080fd5b506101de60045481565b34801561057757600080fd5b50610363610586366004611d07565b60066020526000908152604090205460ff1681565b3480156105a757600080fd5b506002546104ec906001600160a01b031681565b3480156105c757600080fd5b506102116105d63660046121aa565b611543565b3480156105e757600080fd5b506102116105f6366004611e51565b61161b565b6000546001600160a01b031633146106495760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b80516000905b808210156106b057600061068984848151811061066e5761066e612274565b6020026020010151611000600160ac1b03600c9190911b1690565b6000908152600660205260409020805460ff1916600190811790915592909201915061064f565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d7816040516106e1919061228a565b60405180910390a150565b6000546001600160a01b031633146107355760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610640565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6001600160a01b0385166000908152600b6020526040812054869060ff166107e1576040517f1578328e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107e96116a2565b915060006040518060a0016040528088815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252503360208201526001600160a01b038a1660408201526001606090910152905061085e6116b2565b831561086e5761086e338561103a565b600083815260076020908152604090912082518155818301518051849361089c926001850192910190611c6e565b5060408201516002820180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199091161790556060830151600392830180546080909501511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009095169190921617929092179091556109269080546001019055565b6109328233308a6116f6565b61093b60018055565b604080518481526001600160a01b038a16602082015290810188905233907f25ac57b911b0f66b64c294827f539545fbc3ddd002cafab117776274f3241e4c9060600160405180910390a2505095945050505050565b6109996116b2565b6109a2836117a6565b6109ac8282611311565b60008381526007602052Line truncated
"bytecode": "0x608060405260018055604051620031f9380380620031f98339810160408190526200002a9162000493565b600080546001600160a01b031916339081178255604051909182917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d76908290a3506200007685620000a3565b620000818362000133565b6200008c84620001bd565b620000988282620002a1565b505050505062000616565b6000546001600160a01b03163314620000f25760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b60448201526064015b60405180910390fd5b806003557f70fa43ca70216ad905ade86b9e650a691b2ce5a01980d0a81bdd8324141b8511816040516200012891815260200190565b60405180910390a150565b6000546001600160a01b031633146200017e5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b60028190556040516001600160a01b03821681527fe127cf589a3879da0156d4a24f43b44f65cfa3570de594806b0bfa2fcf06884f9060200162000128565b6000546001600160a01b03163314620002085760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b80516000905b808210156200026e57600062000246848481518110620002325762000232620005b1565b60200260200101516200038760201b60201c565b6000908152600860205260409020805460ff191660019081179091559290920191506200020e565b50507f14a422d2412784a5749d03da98921fe468c98577b767851389a9f58ea5a363d781604051620001289190620005c7565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401620000e9565b815180620003025763df9578836000526004601cfd5b81518114620003195763ff633a386000526004601cfd5b60208301602083018260051b82015b8083146200037f578251600052600a60205260406000208251815550815183517f5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a600080a360208301925060208201915062000328565b505050505050565b600c1b90565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003ce57620003ce6200038d565b604052919050565b60006001600160401b03821115620003f257620003f26200038d565b5060051b60200190565b6001600160a01b03811681146200041257600080fd5b50565b600082601f8301126200042757600080fd5b81516020620004406200043a83620003d6565b620003a3565b82815260059290921b840181019181810190868411156200046057600080fd5b8286015b84811015620004885780516200047a81620003fc565b835291830191830162000464565b509695505050505050565b600080600080600060a08688031215620004ac57600080fd5b8551602080880151919650906001600160401b0380821115620004ce57600080fd5b620004dc8a838b0162000415565b965060408901519150620004f082620003fc565b6060890151919550808211156200050657600080fd5b620005148a838b0162000415565b945060808901519150808211156200052b57600080fd5b508701601f810189136200053e57600080fd5b80516200054f6200043a82620003d6565b81815260059190911b8201830190838101908b8311156200056f57600080fd5b928401925b828410156200059f57835180151581146200058f5760008081fd5b8252928401929084019062000574565b80955050505050509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b818110156200060a5783516001600160a01b031683529284019291840191600101620005e3565b50909695505050505050565b612bd380620006266000396000f3fe6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102156102033660046123d5565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461245c565b6107be565b34801561025457600080fd5b50610268610263366004612643565b610b6d565b005b34801561027657600080fd5b50610268610285366004612680565b610ca7565b34801561029657600080fd5b506102686102a53660046126b9565b610d98565b3480156102b657600080fd5b506103376102c53660046123d5565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e085015290811661010084015216Line truncated
"deployedBytecode": "0x6080604052600436106101dc5760003560e01c80637f94f65d11610102578063ad8f2eed11610095578063d4fac45d11610064578063d4fac45d14610713578063d6e8b9731461075e578063f7d0e04b1461077e578063fb8c5ef01461079e57600080fd5b8063ad8f2eed14610659578063b0983d3914610699578063c52164c6146106b9578063d1c07028146106e657600080fd5b80638db564c2116100d15780638db564c2146105c55780639872dbfe146105db57806398a26871146105f15780639eee8d4b1461062157600080fd5b80637f94f65d146104f257806380e1d3021461051257806384ab1d28146105525780638da5cb5b1461059857600080fd5b80634b2ae9801161017a5780636a146024116101495780636a146024146104695780636d82d9e01461048557806374ba03a0146104a557806377cd38a4146104c557600080fd5b80634b2ae980146103e3578063574983c8146104045780635fd8c7101461042457806369cc6af41461043957600080fd5b806313af4035116101b657806313af40351461026a578063328a71811461028a578063367821f0146102aa578063461f3120146103a357600080fd5b806304937320146101e85780630a98b9bd146102285780630d2a2d441461024857600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102156102033660046123d5565b60076020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b5061021561024336600461245c565b6107be565b34801561025457600080fd5b50610268610263366004612643565b610b6d565b005b34801561027657600080fd5b50610268610285366004612680565b610ca7565b34801561029657600080fd5b506102686102a53660046126b9565b610d98565b3480156102b657600080fd5b506103376102c53660046123d5565b6005602081905260009182526040909120805460018201546002830154600384015460048501549585015460068601546007870154600888015460099098015496989597949693959473ffffffffffffffffffffffffffffffffffffffff93841694928416939182169290821691168a565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925273ffffffffffffffffffffffffffffffffffffffff90811660a087015290811660c086015290811660e0850152908116610100840152166101208201526101400161021f565b3480156103af57600080fd5b506103d36103be3660046123d5565b60096020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156103ef57600080fd5b506102156103fe366004612680565b600c1b90565b34801561041057600080fd5b5061026861041f3660046123d5565b610fd9565b34801561043057600080fd5b5061026861108f565b34801561044557600080fd5b506103d3610454366004612680565b600a6020526000908152604090205460ff1681565b34801561047557600080fd5b50610215670de0b6b3a764000081565b34801561049157600080fd5b506102686104a036600461272c565b611151565b3480156104b157600080fd5b506102686104c0366004612761565b611268565b3480156104d157600080fd5b506102156104e03660046123d5565b60066020526000908152604090205481565b3480156104fe57600080fd5b5061026861050d3660046127c5565b611747565b34801561051e57600080fd5b506103d361052d3660046127f1565b600c9190911b6000908152600b60209081526040808320938352929052205460ff1c90565b34801561055e57600080fd5b5061057361056d3660046123d5565b600c1c90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161021f565b3480156105a457600080fd5b506000546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156105d157600080fd5b5061021560045481565b3480156105e757600080fd5b5061021560035481565b3480156105fd57600080fd5b506103d361060c3660046123d5565b60086020526000908152604090205460ff1681565b34801561062d57600080fd5b5061021561063c36600461282a565b600b60209081526000928352604080842090915290825290205481565b34801561066557600080fd5b506105736106743660046127f1565b600c9190911b6000908152600b602090815260408083209383529290522054605f1c90565b3480156106a557600080fd5b506102686106b436600461284f565b61180d565b3480156106c557600080fd5b506002546105739073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106f257600080fd5b50610706610701366004612891565b611a50565b60405161021f91906128d8565b34801561071f57600080fd5b5061021561072e3660046127f1565b600c9190911b6000908152600b6020908152604080832093835292905220546b3fffffffffffffffffffffff1690565b34801561076a57600080fd5b5061026861077936600461291c565b611b2a565b34801561078a57600080fd5b50610268610799366004612680565b611c3a565b3480156107aa57600080fd5b506102686107b93660046129de565b611d06565b60006107c8611e02565b6107d2838361180d565b600c8b901b6000908152600b602090815260408083208d84529091529020548a9060ff1c61082c576040517fb2e532de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c8c901b6000908152600b602090815260408083208484529091529020546b3fffffffffffffffffffffff1687811015610893576040517f22bbb43c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061089f8e600c1b90565b9050600060045460016108b29190612a69565b60008181526005602052604090206004015490915043116108ff576040517fd0404f8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006040518061014001604052808481526020018381526020018d81526020018c8152602001600354436109339190612a69565b8152602001605f600b600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054901c73ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffLine truncated
"linkReferences": {},
"deployedLinkReferences": {}
}
@@ -1,8 +0,0 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
],
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
}
@@ -1,8 +0,0 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
],
"p2pix": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"token": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
}
@@ -1,8 +0,0 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
],
"p2pix": "0x5f3EFA9A90532914545CEf527C530658af87e196",
"token": "0x294003F602c321627152c6b7DED3EAb5bEa853Ee"
}
@@ -1,6 +0,0 @@
{
"wallets":[
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
]
}
+7 -7
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import SearchComponent from "@/components/SearchComponent.vue";
import ValidationComponent from "@/components/LoadingComponent.vue";
import LoadingComponent from "@/components/LoadingComponent/LoadingComponent.vue";
import BuyConfirmedComponent from "@/components/BuyConfirmedComponent/BuyConfirmedComponent.vue";
import { ref, onMounted } from "vue";
import { useEtherStore } from "@/store/ether";
@@ -27,7 +27,7 @@ etherStore.setSellerView(false);
// States
const { loadingLock, walletAddress } = storeToRefs(etherStore);
const flowStep = ref<Step>(Step.Search);
const pixTarget = ref<string>("");
const pixTarget = ref<number>();
const tokenAmount = ref<number>();
const _lockID = ref<string>("");
const loadingRelease = ref<boolean>(false);
@@ -46,7 +46,7 @@ const confirmBuyClick = async (
flowStep.value = Step.Buy;
etherStore.setLoadingLock(true);
await addLock(selectedDeposit.depositID, tokenValue)
await addLock(selectedDeposit.seller, selectedDeposit.token, tokenValue)
.then((lockID) => {
_lockID.value = lockID;
})
@@ -63,7 +63,7 @@ const releaseTransaction = async (e2eId: string) => {
flowStep.value = Step.List;
loadingRelease.value = true;
if (_lockID.value && tokenAmount.value) {
if (_lockID.value && tokenAmount.value && pixTarget.value) {
const release = await releaseLock(
pixTarget.value,
tokenAmount.value,
@@ -96,12 +96,12 @@ onMounted(async () => {
/>
<div v-if="flowStep == Step.Buy">
<QrCodeComponent
:pixTarget="pixTarget"
:pixTarget="String(pixTarget)"
:tokenValue="tokenAmount"
@pix-validated="releaseTransaction"
v-if="!loadingLock"
/>
<ValidationComponent
<LoadingComponent
v-if="loadingLock"
:message="'A transação está sendo enviada para a rede'"
/>
@@ -113,7 +113,7 @@ onMounted(async () => {
:tokenAmount="tokenAmount"
@make-another-transaction="flowStep = Step.Search"
/>
<ValidationComponent
<LoadingComponent
v-if="loadingRelease"
:message="'A transação está sendo enviada para a rede. Em breve os tokens serão depositados em sua carteira.'"
/>
+4 -12
View File
@@ -4,7 +4,7 @@ import { storeToRefs } from "pinia";
import ListingComponent from "@/components/ListingComponent/ListingComponent.vue";
import type { BigNumber } from "ethers";
import { ref, watch, onMounted } from "vue";
import { cancelDeposit, withdrawDeposit } from "@/blockchain/buyerMethods";
import { withdrawDeposit } from "@/blockchain/buyerMethods";
import { listValidDepositTransactionsByWalletAddress } from "@/blockchain/wallet";
import type { ValidDeposit } from "@/model/ValidDeposit";
@@ -24,16 +24,9 @@ onMounted(async () => {
}
});
const handleCancelDeposit = async (depositID: BigNumber, index: number) => {
const response = await cancelDeposit(depositID);
if (response) {
console.log("Depósito cancelado com sucesso.");
depositList.value.splice(index, 1);
}
};
const handleWithDrawDeposit = async (depositID: BigNumber, index: number) => {
const response = await withdrawDeposit(depositID);
const handleWithDrawDeposit = async (token: BigNumber, index: number) => {
const fixedAmount = "1"; // Need to ask user for amount
const response = await withdrawDeposit(token, fixedAmount);
if (response) {
console.log("Token retirado com sucesso.");
depositList.value.splice(index, 1);
@@ -68,7 +61,6 @@ watch(networkName, async () => {
<ListingComponent
:wallet-transactions="depositList"
:is-manage-mode="true"
@cancel-deposit="handleCancelDeposit"
@withdraw-deposit="handleWithDrawDeposit"
></ListingComponent>
</div>
+3 -3
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import WantSellComponent from "../components/SellerSteps/WantSellComponent.vue";
import SendNetwork from "../components/SellerSteps/SendNetwork.vue";
import ValidationComponent from "../components/LoadingComponent.vue";
import LoadingComponent from "@/components/LoadingComponent/LoadingComponent.vue";
import { approveTokens, addDeposit } from "../blockchain/sellerMethods";
import { ref } from "vue";
@@ -57,7 +57,7 @@ const sendNetwork = async () => {
<template>
<div v-if="flowStep == Step.Sell">
<WantSellComponent v-if="!loading" @approve-tokens="approveOffer" />
<ValidationComponent
<LoadingComponent
v-if="loading"
:message="'A transação está sendo enviada para a rede.'"
/>
@@ -69,7 +69,7 @@ const sendNetwork = async () => {
v-if="!loading"
@send-network="sendNetwork"
/>
<ValidationComponent
<LoadingComponent
v-if="loading"
:message="'A transação está sendo enviada para a rede.'"
/>
+1
View File
@@ -13,6 +13,7 @@ export default defineConfig({
provider: "c8",
all: true,
src: ["./src"],
exclude: ["model/**", "**/__tests__/**"],
reporter: ["text", "lcov", "html"],
},
},
+27
View File
@@ -1498,6 +1498,11 @@
dependencies:
vue "^2.5.16"
"@types/web-bluetooth@^0.0.16":
version "0.0.16"
resolved "https://registry.yarnpkg.com/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz#1d12873a8e49567371f2a75fe3e7f7edca6662d8"
integrity sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==
"@typescript-eslint/eslint-plugin@^5.0.0":
version "5.40.1"
resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz"
@@ -1873,6 +1878,28 @@
resolved "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.1.3.tgz"
integrity sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==
"@vueuse/core@^9.12.0":
version "9.12.0"
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-9.12.0.tgz#e5b20f901e081c7ae5fe0e5f3af217929034eefe"
integrity sha512-h/Di8Bvf6xRcvS/PvUVheiMYYz3U0tH3X25YxONSaAUBa841ayMwxkuzx/DGUMCW/wHWzD8tRy2zYmOC36r4sg==
dependencies:
"@types/web-bluetooth" "^0.0.16"
"@vueuse/metadata" "9.12.0"
"@vueuse/shared" "9.12.0"
vue-demi "*"
"@vueuse/metadata@9.12.0":
version "9.12.0"
resolved "https://registry.yarnpkg.com/@vueuse/metadata/-/metadata-9.12.0.tgz#19a0fefcba6a66a2382af10a7a67ebad6eec1f27"
integrity sha512-9oJ9MM9lFLlmvxXUqsR1wLt1uF7EVbP5iYaHJYqk+G2PbMjY6EXvZeTjbdO89HgoF5cI6z49o2zT/jD9SVoNpQ==
"@vueuse/shared@9.12.0":
version "9.12.0"
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-9.12.0.tgz#e6597da80084cba8fc3d6545f4c2fa9817b80428"
integrity sha512-TWuJLACQ0BVithVTRbex4Wf1a1VaRuSpVeyEd4vMUWl54PzlE0ciFUshKCXnlLuD0lxIaLK4Ypj3NXYzZh4+SQ==
dependencies:
vue-demi "*"
abab@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"