This repository was archived by the owner on Mar 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeployMockToken.js
More file actions
54 lines (47 loc) · 1.48 KB
/
deployMockToken.js
File metadata and controls
54 lines (47 loc) · 1.48 KB
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
'use strict';
/**
* @fileoverview Nodejs Program to deploy MockToken.
* See perform method for sample code.
*
* Contract: https://github.com/OpenSTFoundation/mosaic-contracts/blob/v0.9.3-rc1/contracts/SimpleToken/MockToken.sol
* @author kedar@ost.com (Kedar Chandrayan)
*/
const PerformerBase = require('./PerformerBase');
class Performer extends PerformerBase {
constructor(program) {
super(program);
let config = this.getSetupConfig();
let openST = this.openST;
//Set the deployer params.
this.deployParams = {
from: config.deployerAddress,
gasPrice: config.gasPrice,
gas: config.gas
};
}
perform() {
//1. Create a deployer.
let deployer = new this.openST.Deployer(this.deployParams);
//2. Deploy MockToken.
this.log('Deploying MockToken');
deployer
.deployEIP20Token()
.then((receipt) => {
this.logReceipt(receipt);
if (receipt.status && receipt.contractAddress) {
this.exitWithoutError('MockToken Contract Address:', receipt.contractAddress);
} else {
this.exitWithError('Failed to deploy MockToken. See receipt for details.');
}
})
.catch((reason) => {
this.logError(reason);
this.exitWithError('Failed to deploy contract. See error for details.');
});
}
}
let fileName = 'deployMockToken.js';
const program = PerformerBase.getProgram();
program.parse(process.argv);
let performer = new Performer(program);
performer.perform();