1
- const { ContractFactory, Wallet, providers : { JsonRpcProvider } , utils : { id } } = require ( "ethers" )
1
+ #!/usr/bin/env node
2
+
3
+ // Binance Smart Chain
4
+ const providerUrl = "https://bsc-dataseed.binance.org/"
5
+ const explorerUrl = "https://bscscan.com/tx"
2
6
7
+ // Matic's Polygon
8
+ // const providerUrl = "https://polygon-rpc.com"
9
+ // const explorerUrl = "https://polygonscan.com/tx"
10
+
11
+ // Plain token, same as mainnet
3
12
const DATAv2Json = require ( "../artifacts/contracts/DATAv2.sol/DATAv2.json" )
4
13
5
- const { KEY } = process . env
14
+ // Matic's Polygon wants a special token for the bridge
15
+ // const DATAv2Json = require("../artifacts/contracts/DATAv2onPolygon.sol/DATAv2onPolygon.json")
6
16
17
+
18
+ const { ContractFactory, Wallet, providers : { JsonRpcProvider } , utils : { id } } = require ( "ethers" )
19
+
20
+ const { KEY } = process . env
7
21
if ( ! KEY ) { throw new Error ( "Please provide env variable KEY" ) }
8
22
9
- const provider = new JsonRpcProvider ( "https://bsc-dataseed.binance.org/" )
23
+ const provider = new JsonRpcProvider ( providerUrl )
10
24
const deployer = new Wallet ( KEY , provider )
11
25
console . log ( "Deploying contracts from %s" , deployer . address )
12
26
@@ -15,19 +29,20 @@ const adminAddress = "0x42355e7dc0A872C465bE9DE4AcAAAcB5709Ce813"
15
29
async function main ( ) {
16
30
17
31
const DATAv2 = new ContractFactory ( DATAv2Json . abi , DATAv2Json . bytecode , deployer )
18
- const token = await DATAv2 . deploy ( )
19
- console . log ( "Follow deployment: https://bscscan.com/tx/%s" , token . deployTransaction . hash )
32
+ const token = await DATAv2 . deploy ( ) // plain token
33
+ // const token = await DATAv2.deploy("0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa") // Matic's Polygon version of the token
34
+ console . log ( "Follow deployment: %s/%s" , explorerUrl , token . deployTransaction . hash )
20
35
21
36
await token . deployed ( )
22
37
console . log ( "DATAv2 deployed to:" , token . address )
23
38
24
39
const tx1 = await token . grantRole ( id ( "MINTER_ROLE" ) , adminAddress )
25
- console . log ( "Follow grant minter tx: https://bscscan.com/tx/ %s" , tx1 . hash )
40
+ console . log ( "Follow grant minter tx: %s/ %s" , explorerUrl , tx1 . hash )
26
41
const tr1 = await tx1 . wait ( )
27
42
console . log ( "Transaction receipt: " , tr1 )
28
43
29
44
const tx2 = await token . grantRole ( "0x0000000000000000000000000000000000000000000000000000000000000000" , adminAddress )
30
- console . log ( "Follow grant admin tx: https://bscscan.com/tx/ %s" , tx2 . hash )
45
+ console . log ( "Follow grant admin tx: %s/ %s" , explorerUrl , tx2 . hash )
31
46
const tr2 = await tx2 . wait ( )
32
47
console . log ( "Transaction receipt: " , tr2 )
33
48
}
0 commit comments