add smart contracts static files to project temporarily
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
parent
35a92b2ca8
commit
d5467286b0
@ -2,9 +2,10 @@ import { useEtherStore } from "@/store/ether";
|
|||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
|
|
||||||
// smart contract imports
|
// smart contract imports
|
||||||
import mocktoken from "../../../p2pix-smart-contracts/artifacts/contracts/mockToken.sol/MockToken.json"
|
import mockToken from "./smart_contract_files/MockToken.json"
|
||||||
import p2pix from "../../../p2pix-smart-contracts/artifacts/contracts/p2pix.sol/P2PIX.json"
|
import p2pix from "./smart_contract_files/P2PIX.json"
|
||||||
import addresses from "../../../p2pix-smart-contracts/deploys/localhost.json"
|
import addresses from "./smart_contract_files/localhost.json"
|
||||||
|
|
||||||
|
|
||||||
const updateWalletStatus = async (walletAddress: string) => {
|
const updateWalletStatus = async (walletAddress: string) => {
|
||||||
const etherStore = useEtherStore();
|
const etherStore = useEtherStore();
|
||||||
@ -12,7 +13,7 @@ const updateWalletStatus = async (walletAddress: string) => {
|
|||||||
if(!provider) return;
|
if(!provider) return;
|
||||||
|
|
||||||
const signer = provider.getSigner();
|
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);
|
const balance = await contract.balanceOf(walletAddress);
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ const connectProvider = async () => {
|
|||||||
if (!connection) return;
|
if (!connection) return;
|
||||||
provider = new ethers.providers.Web3Provider(connection);
|
provider = new ethers.providers.Web3Provider(connection);
|
||||||
const signer = provider.getSigner();
|
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 walletAddress = await provider.send("eth_requestAccounts", []);
|
||||||
const balance = await contract.balanceOf(walletAddress[0]);
|
const balance = await contract.balanceOf(walletAddress[0]);
|
||||||
@ -48,7 +49,7 @@ const makeTransaction = async () => {
|
|||||||
if(!provider) return;
|
if(!provider) return;
|
||||||
|
|
||||||
const signer = provider.getSigner();
|
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 fixedAccount1Address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||||
const tx = await contract.transfer(fixedAccount1Address, ethers.utils.parseEther("100.0"));
|
const tx = await contract.transfer(fixedAccount1Address, ethers.utils.parseEther("100.0"));
|
||||||
|
292
src/utils/smart_contract_files/MockToken.json
Normal file
292
src/utils/smart_contract_files/MockToken.json
Normal file
File diff suppressed because one or more lines are too long
450
src/utils/smart_contract_files/P2PIX.json
Normal file
450
src/utils/smart_contract_files/P2PIX.json
Normal file
File diff suppressed because one or more lines are too long
8
src/utils/smart_contract_files/localhost.json
Normal file
8
src/utils/smart_contract_files/localhost.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"signers": [
|
||||||
|
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
||||||
|
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||||
|
],
|
||||||
|
"p2pix": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
|
||||||
|
"token": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user