-
Notifications
You must be signed in to change notification settings - Fork 4
/
set_talents.ts
50 lines (41 loc) · 1.36 KB
/
set_talents.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
42
43
44
45
46
47
48
49
50
//npx hardhat node
//npx hardhat run set_talents.ts --network hard
import * as env from "hardhat";
import { setTalents } from './utils/initTalents';
import fs from 'fs-extra';
import * as factory from './typechain';
import {ethers} from "hardhat";
import { Signer } from 'ethers';
import { getAddressBookShareFilePath } from './address_config';
console.log("Set New Talents");
let addressBook = {};
async function getContractAddress(path : string){
// @ts-ignore
addressBook = JSON.parse(await fs.readFileSync(path));
}
async function operateRarelifeTalentsAs(wallet: Signer){return factory.RarelifeTalents__factory.connect(addressBook["RarelifeTalents"], wallet);}
async function main(): Promise<void> {
let addressBookFile = getAddressBookShareFilePath();
await getContractAddress(addressBookFile);
const [deployerWallet, actor0Wallet] = await ethers.getSigners();
//new talents
let tlts_list = {
"1011": {
"id": "1011",
"name": "talents 1",
"description": "desc"
}
};
let tlts = await operateRarelifeTalentsAs(actor0Wallet);
await setTalents(tlts, tlts_list);
}
const args = require('minimist')(process.argv.slice(2));
if (args.network) {
env.changeNetwork(args.network);
}
main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error);
process.exit(1);
});