Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"resolver",
"provider",
"contracts_build_directory"
]);
this.config = Config.default().merge(options);
this.logger = options.logger || console;
this.initial_resolver = options.resolver;
this.provider = options.provider;
this.can_snapshot = false;
this.first_snapshot = true;
this.initial_snapshot = null;
this.known_events = {};
this.interfaceAdapter = createInterfaceAdapter({
provider: options.provider,
networkType: options.networks[options.network].type
});
// For each test
this.currentTestStartBlock = null;
this.BEFORE_TIMEOUT =
(options.mocha && options.mocha.before_timeout) || 120000;
this.TEST_TIMEOUT = (options.mocha && options.mocha.timeout) || 300000;
}
"migrations_directory",
"networks",
"network",
"network_id",
"provider",
"resolver",
"build_directory"
]);
this.options = options;
this.repl = options.repl || new ReplManager(options);
this.command = new Command(tasks);
this.interfaceAdapter = new InterfaceAdapter();
this.web3 = new Web3Shim({
provider: options.provider,
networkType: options.networks[options.network].type
});
// Bubble the ReplManager's exit event
this.repl.on("exit", () => this.emit("exit"));
}
"contracts_build_directory",
"migrations_directory",
"networks",
"network",
"network_id",
"provider",
"resolver",
"build_directory"
]);
this.options = options;
this.repl = options.repl || new ReplManager(options);
this.command = new Command(tasks);
this.interfaceAdapter = new InterfaceAdapter();
this.web3 = new Web3Shim({
provider: options.provider,
networkType: options.networks[options.network].type
});
// Bubble the ReplManager's exit event
this.repl.on("exit", () => this.emit("exit"));
}
network_id = json;
json = this._json;
}
json = utils.merge({}, this._json || {}, json);
temp._constructorMethods = this._constructorMethods;
temp._properties = this._properties;
temp._property_values = {};
temp._json = json;
bootstrap(temp);
temp.interfaceAdapter = new InterfaceAdapter();
temp.web3 = new Web3Shim({
networkType: temp.networkType
});
temp.class_defaults = temp.prototype.defaults || {};
if (network_id) {
temp.setNetwork(network_id);
}
// Copy over custom key/values to the contract class
Object.keys(json).forEach(key => {
if (key.indexOf("x-") !== 0) return;
temp[key] = json[key];
});
return temp;
},
const provider = Provider.create(network_options);
const first = network_id + "";
const second = network_options.network_id + "";
if (first === second) return callback(null, true);
const isFirstANumber = isNaN(parseInt(network_id)) === false;
const isSecondANumber =
isNaN(parseInt(network_options.network_id)) === false;
// If both network ids are numbers, then they don't match, and we should quit.
if (isFirstANumber && isSecondANumber) return callback(null, false);
const interfaceAdapter = new InterfaceAdapter();
const web3 = new Web3Shim({
provider,
networkType: network_options.type
});
web3.eth.net
.getId(current_network_id => {
if (first === current_network_id) return callback(null, true);
if (isFirstANumber === false) {
BlockchainUtils.matches(first, provider, callback);
} else {
// Nothing else to compare.
return callback(null, false);
}
})
.catch(callback);
}
if (typeof json !== "object") {
network_id = json;
json = this._json;
}
json = utils.merge({}, this._json || {}, json);
temp._constructorMethods = this._constructorMethods;
temp._properties = this._properties;
temp._property_values = {};
temp._json = json;
bootstrap(temp);
temp.web3 = new Web3Shim({
networkType: temp.networkType
});
temp.class_defaults = temp.prototype.defaults || {};
if (network_id) {
temp.setNetwork(network_id);
}
// Copy over custom key/values to the contract class
Object.keys(json).forEach(key => {
if (key.indexOf("x-") !== 0) return;
temp[key] = json[key];
});
return temp;
},
prepareForMigrations(options) {
const logger = options.logger;
const interfaceAdapter = createInterfaceAdapter({
provider: options.provider,
networkType: options.networks[options.network].type
});
const web3 = new Web3Shim({
provider: options.provider,
networkType: options.networks[options.network].type
});
const resolver = new ResolverIntercept(options.resolver);
// Initial context.
const context = { web3, interfaceAdapter, config: this.config };
const deployer = new Deployer({
logger,
confirmations: options.confirmations,
timeoutBlocks: options.timeoutBlocks,
networks: options.networks,
network: options.network,
network_id: options.network_id,
matchesNetwork: async function(network_id, network_options, callback) {
const provider = Provider.create(network_options);
const first = network_id + "";
const second = network_options.network_id + "";
if (first === second) return callback(null, true);
const isFirstANumber = isNaN(parseInt(network_id)) === false;
const isSecondANumber =
isNaN(parseInt(network_options.network_id)) === false;
// If both network ids are numbers, then they don't match, and we should quit.
if (isFirstANumber && isSecondANumber) return callback(null, false);
const interfaceAdapter = new InterfaceAdapter();
const web3 = new Web3Shim({
provider,
networkType: network_options.type
});
web3.eth.net
.getId(current_network_id => {
if (first === current_network_id) return callback(null, true);
if (isFirstANumber === false) {
BlockchainUtils.matches(first, provider, callback);
} else {
// Nothing else to compare.
return callback(null, false);
}
})
.catch(callback);
if (typeof json !== "object") {
network_id = json;
json = this._json;
}
json = utils.merge({}, this._json || {}, json);
temp._constructorMethods = this._constructorMethods;
temp._properties = this._properties;
temp._property_values = {};
temp._json = json;
bootstrap(temp);
temp.interfaceAdapter = new InterfaceAdapter();
temp.web3 = new Web3Shim({
networkType: temp.networkType
});
temp.class_defaults = temp.prototype.defaults || {};
if (network_id) {
temp.setNetwork(network_id);
}
// Copy over custom key/values to the contract class
Object.keys(json).forEach(key => {
if (key.indexOf("x-") !== 0) return;
temp[key] = json[key];
});
return temp;
prepareForMigrations(options) {
const logger = options.logger;
const interfaceAdapter = createInterfaceAdapter({
provider: options.provider,
networkType: options.networks[options.network].type
});
const web3 = new Web3Shim({
provider: options.provider,
networkType: options.networks[options.network].type
});
const resolver = new ResolverIntercept(options.resolver);
// Initial context.
const context = { web3, interfaceAdapter, config: this.config };
const deployer = new Deployer({
logger,
confirmations: options.confirmations,