add smart contracts static files to project temporarily

Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR 2022-11-21 16:35:15 -03:00
parent 35a92b2ca8
commit d5467286b0
4 changed files with 757 additions and 6 deletions

View File

@ -2,9 +2,10 @@ import { useEtherStore } from "@/store/ether";
import { ethers } from "ethers";
// smart contract imports
import mocktoken from "../../../p2pix-smart-contracts/artifacts/contracts/mockToken.sol/MockToken.json"
import p2pix from "../../../p2pix-smart-contracts/artifacts/contracts/p2pix.sol/P2PIX.json"
import addresses from "../../../p2pix-smart-contracts/deploys/localhost.json"
import mockToken from "./smart_contract_files/MockToken.json"
import p2pix from "./smart_contract_files/P2PIX.json"
import addresses from "./smart_contract_files/localhost.json"
const updateWalletStatus = async (walletAddress: string) => {
const etherStore = useEtherStore();
@ -12,7 +13,7 @@ const updateWalletStatus = async (walletAddress: string) => {
if(!provider) return;
const signer = provider.getSigner();
const contract = new ethers.Contract(addresses.token, mocktoken.abi, signer);
const contract = new ethers.Contract(addresses.token, mockToken.abi, signer);
const balance = await contract.balanceOf(walletAddress);
@ -29,7 +30,7 @@ const connectProvider = async () => {
if (!connection) return;
provider = new ethers.providers.Web3Provider(connection);
const signer = provider.getSigner();
const contract = new ethers.Contract(addresses.token, mocktoken.abi, signer);
const contract = new ethers.Contract(addresses.token, mockToken.abi, signer);
const walletAddress = await provider.send("eth_requestAccounts", []);
const balance = await contract.balanceOf(walletAddress[0]);
@ -48,7 +49,7 @@ const makeTransaction = async () => {
if(!provider) return;
const signer = provider.getSigner();
const contract = new ethers.Contract(addresses.token, mocktoken.abi, signer);
const contract = new ethers.Contract(addresses.token, mockToken.abi, signer);
const fixedAccount1Address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
const tx = await contract.transfer(fixedAccount1Address, ethers.utils.parseEther("100.0"));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
{
"signers": [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
],
"p2pix": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"token": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
}