Added different types of tokens.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user