-
Notifications
You must be signed in to change notification settings - Fork 1
/
setPilots.ts
41 lines (35 loc) · 1.24 KB
/
setPilots.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
34
35
36
37
38
39
40
41
import { ethers, network, rigsDeployment } from "hardhat";
import { TablelandRigs } from "../typechain-types";
async function main() {
console.log(`\nSetting pilots 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 contract address '${rigsDeployment.contractAddress}'`);
// Get pilots address
if (rigsDeployment.pilotsAddress === "") {
throw Error(`no pilotsAddress entry for '${network.name}'`);
}
console.log(`Using pilots address '${rigsDeployment.pilotsAddress}'`);
// Update pilots address
const rigs = (await ethers.getContractFactory("TablelandRigs")).attach(
rigsDeployment.contractAddress
) as TablelandRigs;
const tx = await rigs.initPilots(rigsDeployment.pilotsAddress);
const receipt = await tx.wait();
console.log(
`pilots set to '${rigsDeployment.pilotsAddress}' with txn '${receipt.transactionHash}'`
);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});