Skip to content

Commit 971dc66

Browse files
committed
feat: deployment script without the migrator (only new token)
1 parent 5d71cac commit 971dc66

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

scripts/deploy-without-migrator.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const { ContractFactory, Wallet, providers: { JsonRpcProvider }, utils: { id } } = require("ethers")
2+
3+
const DATAv2Json = require("../artifacts/contracts/DATAv2.sol/DATAv2.json")
4+
5+
const { KEY } = process.env
6+
7+
if (!KEY) { throw new Error("Please provide env variable KEY") }
8+
9+
const provider = new JsonRpcProvider("https://bsc-dataseed.binance.org/")
10+
const deployer = new Wallet(KEY, provider)
11+
console.log("Deploying contracts from %s", deployer.address)
12+
13+
const adminAddress = "0x42355e7dc0A872C465bE9DE4AcAAAcB5709Ce813"
14+
15+
async function main() {
16+
17+
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)
20+
21+
await token.deployed()
22+
console.log("DATAv2 deployed to:", token.address)
23+
24+
const tx1 = await token.grantRole(id("MINTER_ROLE"), adminAddress)
25+
console.log("Follow grant minter tx: https://bscscan.com/tx/%s", tx1.hash)
26+
const tr1 = await tx1.wait()
27+
console.log("Transaction receipt: ", tr1)
28+
29+
const tx2 = await token.grantRole("0x0000000000000000000000000000000000000000000000000000000000000000", adminAddress)
30+
console.log("Follow grant admin tx: https://bscscan.com/tx/%s", tx2.hash)
31+
const tr2 = await tx2.wait()
32+
console.log("Transaction receipt: ", tr2)
33+
}
34+
35+
// We recommend this pattern to be able to use async/await everywhere
36+
// and properly handle errors.
37+
main()
38+
.then(() => process.exit(0))
39+
.catch(error => {
40+
console.error(error)
41+
process.exit(1)
42+
})

0 commit comments

Comments
 (0)