File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
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 ) ) ;
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments