forked from alchemistcoin/alchemist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.ts
46 lines (33 loc) · 1.08 KB
/
mock.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
import { parseEther } from 'ethers/lib/utils'
import { task } from 'hardhat/config'
task('deploy-mock-token', 'deploy mock token')
.addFlag('verify', 'verify contracts on etherscan')
.setAction(async (args, { ethers, run, network }) => {
// log config
console.log('Network')
console.log(' ', network.name)
console.log('Task Args')
console.log(args)
// compile
await run('compile')
// get signer
const signer = (await ethers.getSigners())[0]
console.log('Signer')
console.log(' at', signer.address)
// deploy token
const tokenArgs = [signer.address, parseEther('1000')]
const token = await (await ethers.getContractFactory('MockERC20'))
.connect(signer)
.deploy(...tokenArgs)
console.log('Deploying MockERC20')
console.log(' to', token.address)
console.log(' in', token.deployTransaction.hash)
// verify source
if (args.verify) {
await token.deployTransaction.wait(5)
await run('verify:verify', {
address: token.address,
constructorArguments: tokenArgs,
})
}
})