generated from nicobevilacqua/hardhat-solidity-typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 7
/
15-FiftyYears.test.ts
34 lines (27 loc) · 869 Bytes
/
15-FiftyYears.test.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
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { expect } from 'chai';
import { Contract } from 'ethers';
import { ethers } from 'hardhat';
const { utils, provider } = ethers;
describe('FiftyYearsChallenge', () => {
let target: Contract;
let attacker: SignerWithAddress;
let deployer: SignerWithAddress;
before(async () => {
[attacker, deployer] = await ethers.getSigners();
target = await (
await ethers.getContractFactory('FiftyYearsChallenge', deployer)
).deploy(deployer.address, {
value: utils.parseEther('1'),
});
await target.deployed();
target = target.connect(attacker);
});
it('exploit', async () => {
/**
* YOUR CODE HERE
* */
expect(await provider.getBalance(target.address)).to.equal(0);
expect(await target.isComplete()).to.equal(true);
});
});