Skip to content

Commit 91da88e

Browse files
authored
Merge pull request #210 from PhyrexTsai/master
v0.1.13
2 parents 6b453bf + 2c775ca commit 91da88e

File tree

20 files changed

+263
-55
lines changed

20 files changed

+263
-55
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ The KAIZEN Platform is currently in experimental alpha.
100100
- [Sia](https://sia.tech/) - Decentralized file storage
101101
- [NOIA](http://noia.network/) - Decentralized CDN
102102
- [Near](https://nearprotocol.com/) - Scalable decentralized application
103+
- [Tellor](https://tellor.io/) - Decentralized oracle service
103104

104105
## <a name="instances"></a>⚙️ Instances
105106
- [NYM](http://nymtech.net/) - Decentralized privacy

README_KR.md

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ The KAIZEN Platform is currently in experimental alpha.
9999
- [Sia](https://sia.tech/) - Decentralized file storage
100100
- [NOIA](http://noia.network/) - Decentralized CDN
101101
- [Near](https://nearprotocol.com/) - Scalable decentralized application
102+
- [Tellor](https://tellor.io/) - Decentralized oracle service
102103

103104
## <a name="instances"></a>⚙️ 인스턴스
104105
- [NYM](http://nymtech.net/) - Decentralized privacy

README_ZH.md

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ KAIZEN Platform 目前正在 Alpha 階段
9999
- [Sia](https://sia.tech/) - Decentralized file storage
100100
- [NOIA](http://noia.network/) - Decentralized CDN
101101
- [Near](https://nearprotocol.com/) - Scalable decentralized application
102+
- [Tellor](https://tellor.io/) - Decentralized oracle service
102103

103104
## <a name="instances"></a>⚙️ 實例
104105
- [NYM](http://nymtech.net/) - Decentralized privacy

build/components/Contracts/Deploy/index.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function builder(yargs) {
2929
alias: 'u',
3030
type: 'string',
3131
describe: 'URL of the template contract'
32+
}).option('network', {
33+
alias: 'n',
34+
type: 'string',
35+
describe: 'Network of the template contract',
36+
choices: ['development', 'deploy'],
37+
default: 'development'
3238
}).example('kaizen contracts deploy -u https://github.com/PortalNetwork/kaizen-contracts/tree/master/ERC20').demandOption(['url'], '').epilogue('Please enter the url of the template contract\n\n' + 'Support contract template:\n\n'.underline.yellow + 'Chainlink'.underline.yellow + ' - Chainlink Oracle Service, ' + 'https://github.com/PortalNetwork/kaizen-contracts/tree/master/Chainlink'.underline.yellow + '\n' + 'ERC20'.underline.yellow + ' - ERC20 Token Standard, ' + 'https://github.com/PortalNetwork/kaizen-contracts/tree/master/ERC20'.underline.yellow + '\n' + 'ERC721'.underline.yellow + ' - ERC721 Token Standard, ' + 'https://github.com/PortalNetwork/kaizen-contracts/tree/master/ERC721'.underline.yellow + '\n' + 'NuCypher'.underline.yellow + ' - NuCypher Contracts, ' + 'https://github.com/PortalNetwork/kaizen-contracts/tree/master/NuCypher'.underline.yellow + '\n');
3339
}
3440

@@ -40,14 +46,14 @@ function _handler() {
4046
_handler = _asyncToGenerator(
4147
/*#__PURE__*/
4248
regeneratorRuntime.mark(function _callee(argv) {
43-
var repoUrl, kaizenrc, _kaizenrc, privateKey, provider, networkId, _getFilePath, owner, repo, branch, template, zipFilePath, processing, result;
49+
var repoUrl, network, kaizenrc, _kaizenrc, privateKey, provider, networkId, _getFilePath, owner, repo, branch, template, deployNetwork, zipFilePath, processing, result;
4450

4551
return regeneratorRuntime.wrap(function _callee$(_context) {
4652
while (1) {
4753
switch (_context.prev = _context.next) {
4854
case 0:
4955
_context.prev = 0;
50-
repoUrl = argv.url;
56+
repoUrl = argv.url, network = argv.network;
5157
kaizenrc = fsx.readJsonSync(path.resolve(__dirname, '../../../../.kaizenrc'));
5258
_kaizenrc = _objectSpread({}, kaizenrc), privateKey = _kaizenrc.privateKey, provider = _kaizenrc.provider, networkId = _kaizenrc.networkId;
5359

@@ -62,13 +68,14 @@ function _handler() {
6268
console.log("Contract deploying, this may take a while...".yellow);
6369
Spinner.start();
6470
_getFilePath = getFilePath(repoUrl), owner = _getFilePath.owner, repo = _getFilePath.repo, branch = _getFilePath.branch, template = _getFilePath.template;
71+
deployNetwork = template === 'Chainlink' ? 'cldev' : deployNetwork;
6572
zipFilePath = "https://github.com/".concat(owner, "/").concat(repo, "/raw/").concat(branch, "/").concat(template, ".zip");
66-
_context.next = 12;
73+
_context.next = 13;
6774
return download(zipFilePath, '.', {
6875
extract: true
6976
});
7077

71-
case 12:
78+
case 13:
7279
Spinner.stop();
7380
Spinner.start();
7481
console.log("Setup environment variable...".yellow); // Setup environment variable
@@ -80,39 +87,39 @@ function _handler() {
8087
Spinner.stop();
8188
Spinner.start();
8289
console.log("Installing modules...".yellow);
83-
_context.next = 23;
90+
_context.next = 24;
8491
return ExecuteCommand("cd ".concat(template, " && npm i"));
8592

86-
case 23:
93+
case 24:
8794
processing = _context.sent;
8895
Spinner.stop();
8996
console.log(processing); // Build and deploy contracts
9097

9198
console.log("Deploying contracts...".yellow);
92-
_context.next = 29;
93-
return ExecuteCommand("cd ".concat(template, " && ./node_modules/.bin/truffle deploy --network deployment"));
99+
_context.next = 30;
100+
return ExecuteCommand("cd ".concat(template, " && ./node_modules/.bin/truffle migrate --network ").concat(deployNetwork));
94101

95-
case 29:
102+
case 30:
96103
result = _context.sent;
97104
console.log(result);
98105
fsx.removeSync("./".concat(template));
99106
Log.SuccessLog("\nDeploy Contract ".concat(template, " Successfully"));
100-
_context.next = 40;
107+
_context.next = 41;
101108
break;
102109

103-
case 35:
104-
_context.prev = 35;
110+
case 36:
111+
_context.prev = 36;
105112
_context.t0 = _context["catch"](0);
106113
Spinner.stop();
107114
Log.ErrorLog('\nUnable to deploy sontract');
108115
console.error(_context.t0);
109116

110-
case 40:
117+
case 41:
111118
case "end":
112119
return _context.stop();
113120
}
114121
}
115-
}, _callee, this, [[0, 35]]);
122+
}, _callee, this, [[0, 36]]);
116123
}));
117124
return _handler.apply(this, arguments);
118125
}

build/components/Plugins/Install/index.js

+30-17
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ var siaHandler = require('./sia.js');
3232

3333
var nearHandler = require('./near.js');
3434

35+
var tellorHandler = require('./tellor.js');
36+
3537
function builder(yargs) {
3638
return yargs.positional('plugin', {
3739
alias: 'p',
@@ -76,7 +78,7 @@ function _handler() {
7678

7779
case 8:
7880
_context.t0 = plugin;
79-
_context.next = _context.t0 === 'bluzelle' ? 11 : _context.t0 === 'nkn' ? 18 : _context.t0 === 'noia' ? 25 : _context.t0 === 'icon' ? 32 : _context.t0 === 'orbit' ? 39 : _context.t0 === 'arweave' ? 46 : _context.t0 === 'band' ? 53 : _context.t0 === 'fluence' ? 60 : _context.t0 === 'sia' ? 67 : _context.t0 === 'near' ? 74 : 81;
81+
_context.next = _context.t0 === 'bluzelle' ? 11 : _context.t0 === 'nkn' ? 18 : _context.t0 === 'noia' ? 25 : _context.t0 === 'icon' ? 32 : _context.t0 === 'orbit' ? 39 : _context.t0 === 'arweave' ? 46 : _context.t0 === 'band' ? 53 : _context.t0 === 'fluence' ? 60 : _context.t0 === 'sia' ? 67 : _context.t0 === 'near' ? 74 : _context.t0 === 'tellor' ? 81 : 88;
8082
break;
8183

8284
case 11:
@@ -88,7 +90,7 @@ function _handler() {
8890
case 15:
8991
Spinner.stop();
9092
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
91-
return _context.abrupt("break", 82);
93+
return _context.abrupt("break", 89);
9294

9395
case 18:
9496
Log.NormalLog('Installing plugin, please wait a second...');
@@ -99,7 +101,7 @@ function _handler() {
99101
case 22:
100102
Spinner.stop();
101103
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
102-
return _context.abrupt("break", 82);
104+
return _context.abrupt("break", 89);
103105

104106
case 25:
105107
Log.NormalLog('Installing plugin, please wait a second...');
@@ -110,7 +112,7 @@ function _handler() {
110112
case 29:
111113
Spinner.stop();
112114
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
113-
return _context.abrupt("break", 82);
115+
return _context.abrupt("break", 89);
114116

115117
case 32:
116118
Log.NormalLog('Installing plugin, please wait a second...');
@@ -121,7 +123,7 @@ function _handler() {
121123
case 36:
122124
Spinner.stop();
123125
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
124-
return _context.abrupt("break", 82);
126+
return _context.abrupt("break", 89);
125127

126128
case 39:
127129
Log.NormalLog('Installing plugin, please wait a second...');
@@ -132,7 +134,7 @@ function _handler() {
132134
case 43:
133135
Spinner.stop();
134136
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
135-
return _context.abrupt("break", 82);
137+
return _context.abrupt("break", 89);
136138

137139
case 46:
138140
Log.NormalLog('Installing plugin, please wait a second...');
@@ -143,7 +145,7 @@ function _handler() {
143145
case 50:
144146
Spinner.stop();
145147
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
146-
return _context.abrupt("break", 82);
148+
return _context.abrupt("break", 89);
147149

148150
case 53:
149151
Log.NormalLog('Installing plugin, please wait a second...');
@@ -154,7 +156,7 @@ function _handler() {
154156
case 57:
155157
Spinner.stop();
156158
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
157-
return _context.abrupt("break", 82);
159+
return _context.abrupt("break", 89);
158160

159161
case 60:
160162
Log.NormalLog('Installing plugin, please wait a second...');
@@ -165,7 +167,7 @@ function _handler() {
165167
case 64:
166168
Spinner.stop();
167169
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
168-
return _context.abrupt("break", 82);
170+
return _context.abrupt("break", 89);
169171

170172
case 67:
171173
Log.NormalLog('Installing plugin, please wait a second...');
@@ -176,7 +178,7 @@ function _handler() {
176178
case 71:
177179
Spinner.stop();
178180
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
179-
return _context.abrupt("break", 82);
181+
return _context.abrupt("break", 89);
180182

181183
case 74:
182184
Log.NormalLog('Installing plugin, please wait a second...');
@@ -187,28 +189,39 @@ function _handler() {
187189
case 78:
188190
Spinner.stop();
189191
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
190-
return _context.abrupt("break", 82);
192+
return _context.abrupt("break", 89);
191193

192194
case 81:
195+
Log.NormalLog('Installing plugin, please wait a second...');
196+
Spinner.start();
197+
_context.next = 85;
198+
return tellorHandler();
199+
200+
case 85:
201+
Spinner.stop();
202+
Log.SuccessLog("Install plugin ".concat(plugin, " Successfully"));
203+
return _context.abrupt("break", 89);
204+
205+
case 88:
193206
Log.NormalLog('Plugin not support yet');
194207

195-
case 82:
196-
_context.next = 89;
208+
case 89:
209+
_context.next = 96;
197210
break;
198211

199-
case 84:
200-
_context.prev = 84;
212+
case 91:
213+
_context.prev = 91;
201214
_context.t1 = _context["catch"](0);
202215
Spinner.stop();
203216
Log.ErrorLog('something went wrong!');
204217
console.error(_context.t1);
205218

206-
case 89:
219+
case 96:
207220
case "end":
208221
return _context.stop();
209222
}
210223
}
211-
}, _callee, this, [[0, 84]]);
224+
}, _callee, this, [[0, 91]]);
212225
}));
213226
return _handler.apply(this, arguments);
214227
}
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"use strict";
2+
3+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4+
5+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6+
7+
var path = require('path');
8+
9+
var fsx = require('fs-extra');
10+
11+
var ExecuteCommand = require('../../../lib/ExecuteCommand');
12+
13+
module.exports =
14+
/*#__PURE__*/
15+
_asyncToGenerator(
16+
/*#__PURE__*/
17+
regeneratorRuntime.mark(function _callee() {
18+
var configPath, userConfig;
19+
return regeneratorRuntime.wrap(function _callee$(_context) {
20+
while (1) {
21+
switch (_context.prev = _context.next) {
22+
case 0:
23+
_context.next = 2;
24+
return ExecuteCommand('npm install usingtellor');
25+
26+
case 2:
27+
// update user's kaizen config
28+
configPath = path.resolve('./', 'kaizen.json');
29+
userConfig = fsx.existsSync(configPath) ? fsx.readJsonSync(configPath) : {};
30+
31+
if (!userConfig.plugins) {
32+
userConfig.plugins = [];
33+
}
34+
35+
if (userConfig.plugins.includes('tellor') === false) {
36+
userConfig.plugins.push('tellor');
37+
}
38+
39+
fsx.outputJsonSync(path.resolve('./', 'kaizen.json'), userConfig);
40+
41+
case 7:
42+
case "end":
43+
return _context.stop();
44+
}
45+
}
46+
}, _callee, this);
47+
}));

build/components/Plugins/List/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ function _handler() {
3333
Log.NormalLog('fluence'.underline.yellow + ' - Fluence information');
3434
Log.NormalLog('sia'.underline.yellow + ' - Sia information');
3535
Log.NormalLog('near'.underline.yellow + ' - Near information');
36+
Log.NormalLog('tellor'.underline.yellow + ' - Tellor information');
3637
Log.NormalLog("\nTo install a plugin run " + "'kaizen plugins install <plugin-name-here>'".yellow);
3738
Log.NormalLog("\nIt will be automatically downloaded and added to your " + "'package.json'".yellow + " and " + "'kaizen.json'".yellow + " file\n");
3839

39-
case 13:
40+
case 14:
4041
case "end":
4142
return _context.stop();
4243
}

0 commit comments

Comments
 (0)