1
1
#!/usr/bin/env node
2
2
3
+ // PEAQ chain
4
+ const providerUrl = "https://peaq.api.onfinality.io/public"
5
+ const explorerUrl = "https://peaq.subscan.io/tx"
6
+
3
7
// Binance Smart Chain
4
- const providerUrl = "https://bsc-dataseed.binance.org/"
5
- const explorerUrl = "https://bscscan.com/tx"
8
+ // const providerUrl = "https://bsc-dataseed.binance.org/"
9
+ // const explorerUrl = "https://bscscan.com/tx"
6
10
7
11
// Matic's Polygon
8
12
// const providerUrl = "https://polygon-rpc.com"
@@ -15,7 +19,7 @@ const DATAv2Json = require("../artifacts/contracts/DATAv2.sol/DATAv2.json")
15
19
// const DATAv2Json = require("../artifacts/contracts/DATAv2onPolygon.sol/DATAv2onPolygon.json")
16
20
17
21
18
- const { ContractFactory, Wallet, providers : { JsonRpcProvider } , utils : { id } } = require ( "ethers" )
22
+ const { ContractFactory, Wallet, JsonRpcProvider, id } = require ( "ethers" )
19
23
20
24
const { KEY } = process . env
21
25
if ( ! KEY ) { throw new Error ( "Please provide env variable KEY" ) }
@@ -27,14 +31,14 @@ console.log("Deploying contracts from %s", deployer.address)
27
31
const adminAddress = "0x42355e7dc0A872C465bE9DE4AcAAAcB5709Ce813"
28
32
29
33
async function main ( ) {
30
-
31
34
const DATAv2 = new ContractFactory ( DATAv2Json . abi , DATAv2Json . bytecode , deployer )
32
35
const token = await DATAv2 . deploy ( ) // plain token
33
36
// const token = await DATAv2.deploy("0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa") // Matic's Polygon version of the token
34
- console . log ( "Follow deployment: %s/%s" , explorerUrl , token . deployTransaction . hash )
37
+ console . log ( "Follow deployment: %s/%s" , explorerUrl , token . deploymentTransaction ( ) . hash )
35
38
36
39
await token . waitForDeployment ( )
37
- console . log ( "DATAv2 deployed to:" , token . address )
40
+ const tokenAddress = await token . getAddress ( )
41
+ console . log ( "DATAv2 deployed to:" , tokenAddress )
38
42
39
43
const tx1 = await token . grantRole ( id ( "MINTER_ROLE" ) , adminAddress )
40
44
console . log ( "Follow grant minter tx: %s/%s" , explorerUrl , tx1 . hash )
@@ -47,8 +51,6 @@ async function main() {
47
51
console . log ( "Transaction receipt: " , tr2 )
48
52
}
49
53
50
- // We recommend this pattern to be able to use async/await everywhere
51
- // and properly handle errors.
52
54
main ( )
53
55
. then ( ( ) => process . exit ( 0 ) )
54
56
. catch ( error => {
0 commit comments