generated from nicobevilacqua/hardhat-solidity-typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
05-EthernautDAOToken.test.ts
41 lines (32 loc) · 1.22 KB
/
05-EthernautDAOToken.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
35
36
37
38
39
40
41
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { expect } from 'chai';
import { Contract } from 'ethers';
import { ethers } from 'hardhat';
const privateKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
const addressWithBalance = '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266';
describe('EthernautDaoToken', () => {
let target: Contract;
let attacker: SignerWithAddress;
let deployer: SignerWithAddress;
before(async () => {
[, attacker, deployer] = await ethers.getSigners();
target = await (await ethers.getContractFactory('EthernautDaoToken', deployer)).deploy();
await target.deployed();
await (
await target.mint(addressWithBalance, ethers.utils.parseEther('0.000000000000000001'))
).wait();
await (
await target.mint(addressWithBalance, ethers.utils.parseEther('0.099999999999999999'))
).wait();
await (
await target.mint(addressWithBalance, ethers.utils.parseEther('0.999999999999999999'))
).wait();
target = target.connect(attacker);
});
it('attack', async () => {
/**
* YOUR CODE HERE
*/
expect(ethers.utils.formatEther(await target.balanceOf(addressWithBalance))).to.equal('0.0');
});
});