Added different types of tokens.

This commit is contained in:
Filipe Soccol
2024-08-07 14:09:23 -03:00
parent 0a51a80e0c
commit f15361599f
19 changed files with 244 additions and 76 deletions

View File

@@ -5,13 +5,15 @@ import { parseEther } from "ethers/lib/utils";
import { ethers } from "ethers";
import mockToken from "../utils/smart_contract_files/MockToken.json";
import { useEtherStore } from "@/store/ether";
const approveTokens = async (tokenQty: string): Promise<any> => {
const provider = getProvider();
const signer = provider.getSigner();
const etherStore = useEtherStore();
const tokenContract = new ethers.Contract(
getTokenAddress(),
getTokenAddress(etherStore.selectedToken),
mockToken.abi,
signer
);
@@ -27,9 +29,10 @@ const approveTokens = async (tokenQty: string): Promise<any> => {
const addDeposit = async (tokenQty: string, pixKey: string): Promise<any> => {
const p2pContract = getContract();
const etherStore = useEtherStore();
const deposit = await p2pContract.deposit(
getTokenAddress(),
getTokenAddress(etherStore.selectedToken),
parseEther(tokenQty),
pixKey,
true,