-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmany_contracts.js
38 lines (30 loc) · 936 Bytes
/
many_contracts.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 fs = require('fs');
const monax = require('@monax/legacy-contracts');
const status = require('./lib/status');
const jobs = require('./jobs_output.json');
const keys = require('./keys.json');
const chainUrl = "http://192.168.99.100:1337/rpc";
const contractManager = monax.newContractManagerDev(chainUrl, keys);
const abi = JSON.parse(fs.readFileSync('./abi/Factory'));
const address = jobs['deployFactory']
const factory = contractManager.newContractFactory(abi).at(address);
function createContracts() {
factory.createD((error, n) => {
if (error) throw error;
status.print(n);
return createContracts();
})
}
function createManyContracts(i,max){
if ( i == max ){
console.log(`Reached ${max}`);
process.exit(0);
}
factory.createD((error, n) => {
if (error) throw error;
status.print(n);
return createManyContracts(i+1,max);
})
}
// createManyContracts(1,100);
createContracts();