-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
68 lines (55 loc) · 2 KB
/
index.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import chalk from 'chalk';
import { PopulatedTransaction } from 'ethers';
import { task, types } from 'hardhat/config';
import './prepareTx';
import {
etherscanVerify,
etherscanVerifyImplementation,
} from '../helpers/utils';
export const logPopulatedTx = (tx: PopulatedTransaction) => {
console.log({
data: tx.data,
to: tx.to,
});
};
task('verifyProxy')
.addPositionalParam('proxyAddress')
.setAction(async ({ proxyAddress }, hre) => {
await etherscanVerifyImplementation(hre, proxyAddress);
});
task('verifyRegular')
.addPositionalParam('address')
.setAction(async ({ address }, hre) => {
await etherscanVerify(hre, address);
});
task('executeTx')
.addPositionalParam('to', undefined, undefined, types.string)
.addPositionalParam('data', undefined, undefined, types.string)
.addOptionalParam('from', undefined, undefined, types.string)
.addOptionalParam('value', undefined, undefined, types.float)
.setAction(async ({ to, data, from, value }, hre) => {
const { deployer } = await hre.getNamedAccounts();
const signer = await hre.ethers.getSigner(from ?? deployer);
const valueParsed = value
? hre.ethers.utils.parseUnits(value.toString())
: undefined;
const tx = await signer.sendTransaction({
data,
to,
from,
value: valueParsed,
});
console.log(chalk.yellow('Transaction hash: ', tx.hash));
});
task('deployTestToken')
.addOptionalPositionalParam('decimals', undefined, 18, types.int)
.addOptionalPositionalParam('name', undefined, 'TestToken', types.string)
.addOptionalPositionalParam('symbol', undefined, 'TestToken', types.string)
.setAction(async ({ decimals, name, symbol }, hre) => {
const { deployer } = await hre.getNamedAccounts();
const signer = await hre.ethers.getSigner(deployer);
const token = await (
await hre.ethers.getContractFactory('ERC20MockWithName', signer)
).deploy(decimals, name, symbol);
console.log(chalk.yellow('Token deployed at: ', token.address));
});