-
Notifications
You must be signed in to change notification settings - Fork 1
/
setAdmin.ts
33 lines (28 loc) · 987 Bytes
/
setAdmin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { ethers, network, rigsConfig, rigsDeployment } from "hardhat";
import { TablelandRigs } from "../typechain-types";
async function main() {
console.log(`\nSetting admin on '${network.name}'...`);
// Get owner account
const [account] = await ethers.getSigners();
if (account.provider === undefined) {
throw Error("missing provider");
}
// Get contract address
if (rigsDeployment.contractAddress === "") {
throw Error(`no contractAddress entry for '${network.name}'`);
}
console.log(`Using address '${rigsDeployment.contractAddress}'`);
// Set admin
const rigs = (await ethers.getContractFactory("TablelandRigs")).attach(
rigsDeployment.contractAddress
) as TablelandRigs;
const tx = await rigs.setAdmin(rigsConfig.admin);
const receipt = await tx.wait();
console.log(`set admin with txn '${receipt.transactionHash}'`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});