-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.js
82 lines (76 loc) · 2.49 KB
/
compile.js
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require("path");
const fs = require("fs");
const solc = require("solc");
const contractPath = path.resolve(__dirname, "contracts");
const input = {
language: "Solidity",
sources: {
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
content: fs.readFileSync(
path.resolve(__dirname, "node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol"),
"utf8"
)
},
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
content: fs.readFileSync(
path.resolve(__dirname, "node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"),
"utf8"
)
},
"@openzeppelin/contracts/utils/Context.sol": {
content: fs.readFileSync(
path.resolve(__dirname, "node_modules/@openzeppelin/contracts/utils/Context.sol"),
"utf8"
)
},
"@openzeppelin/contracts/token/ERC20/ERC20.sol": {
content: fs.readFileSync(
path.resolve(__dirname, "node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol"),
"utf8"
)
},
"interfaces/IERC20Minimal.sol": {
content: fs.readFileSync(
path.resolve(contractPath, "interfaces", "IERC20Minimal.sol"),
"utf8"
)
},
"PigifyTokenRegistrar.sol": {
content: fs.readFileSync(
path.resolve(contractPath, "PigifyTokenRegistrar.sol"),
"utf8"
)
},
"PigifyTokenPool.sol": {
content: fs.readFileSync(
path.resolve(contractPath, "PigifyTokenPool.sol"),
"utf8"
)
},
"PigifyNativeToken.sol": {
content: fs.readFileSync(
path.resolve(contractPath, "PigifyNativeToken.sol"),
"utf8"
)
},
"Pigify.sol": {
content: fs.readFileSync(
path.resolve(contractPath, "Pigify.sol"),
"utf8"
)
}
},
settings: {
outputSelection: {
"*": {
"*": ["*"]
}
}
}
};
const compilation = JSON.parse(solc.compile(JSON.stringify(input)));
const compilationObject = compilation.contracts["Pigify.sol"].Pigify;
const output = {};
output.abi = compilationObject.abi;
output.bytecode = compilationObject.evm.bytecode.object;
module.exports = output;