generated from nicobevilacqua/hardhat-solidity-typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNicknameChallenge.ts
38 lines (28 loc) · 1.14 KB
/
NicknameChallenge.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
import { ethers } from 'hardhat';
const { utils } = ethers;
const captureTheEtherAddress = '0x71c46Ed333C35e4E6c62D32dc7C8F00D125b4fee';
const nicknameChallengeAddress = '0x9502db98c2c92CDAa6Fc40E5e738FDc3AdA9AdA3';
async function main() {
console.log('deploying');
const [CaptureTheEtherFactory, NicknameChallengeFactory] = await Promise.all([
ethers.getContractFactory('CaptureTheEther'),
ethers.getContractFactory('NicknameChallenge'),
]);
const [captureTheEther, nicknameChallenge] = await Promise.all([
CaptureTheEtherFactory.attach(captureTheEtherAddress),
NicknameChallengeFactory.attach(nicknameChallengeAddress),
]);
await Promise.all([captureTheEther.deployed(), nicknameChallenge.deployed()]);
console.log(`captureTheEther address ${captureTheEther.address}`);
console.log(`nicknameChallenge address ${captureTheEther.address}`);
const inBytes = utils.formatBytes32String('PeronPeron');
console.log('setting nickname');
const tx = await captureTheEther.setNickname(inBytes);
await tx.wait();
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});