-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompile.js
38 lines (33 loc) · 1.02 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
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const gamePath = path.resolve(__dirname, 'contracts/gametypes', 'Game.sol');
const gameSource = fs.readFileSync(gamePath, 'utf8');
const analogGamePath = path.resolve(__dirname, 'contracts/gametypes', 'AnalogGame.sol');
const analogGameSource = fs.readFileSync(analogGamePath, 'utf8');
const ethStakingGamePath = path.resolve(__dirname, 'contracts', 'ETHStakingGame.sol');
const ethStakingGameSource = fs.readFileSync(ethStakingGamePath, 'utf8');
const input = {
language: 'Solidity',
sources: {
'gametypes/Game.sol': {
content: gameSource,
},
'gametypes/AnalogGame.sol': {
content: analogGameSource,
},
'ETHStakingGame.sol': {
content: ethStakingGameSource,
},
},
settings: {
outputSelection: {
'*': {
'*': ['*'],
},
},
},
};
module.exports = JSON.parse(solc.compile(JSON.stringify(input))).contracts[
'Game.sol', 'AnalogGame.sol', 'ETHStakingGame.sol'
].ETHStakingGame;