Skip to content

Commit 47da781

Browse files
committed
set test ether and deploy files on local
1 parent 32e463e commit 47da781

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ether.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ethers } from 'ethers';
2+
import contractABI from './client/src/artifacts/contracts/Upload.sol/Upload.json';
3+
import CONTRACT_ADDRESS from "./config";
4+
5+
const provider = new ethers.providers.Web3Provider(window.ethereum);
6+
const contractAddress = `${CONTRACT_ADDRESS}`;
7+
const contract = new ethers.Contract(contractAddress, contractABI, provider.getSigner());
8+
9+
contract.methods.add('0xUserAddress', 'http://example.com').send({ from: '0xYourAddress' })
10+
.then(result => console.log(result))
11+
.catch(err => console.error(err));

scripts/deploy.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const hre = require("hardhat");
2+
3+
async function main() {
4+
const Upload = await hre.ethers.getContractFactory("Upload");
5+
const upload = await Upload.deploy();
6+
7+
await upload.deployed();
8+
9+
console.log("Upload contract deployed to:", upload.address);
10+
}
11+
12+
main()
13+
.then(() => process.exit(0))
14+
.catch((error) => {
15+
console.error(error);
16+
process.exit(1);
17+
});

0 commit comments

Comments
 (0)