Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async _load(options, context, deployer, resolver) {
// Load assets and run `execute`
const accounts = await context.interfaceAdapter.getAccounts();
const requireOptions = {
file: this.file,
context: context,
resolver: resolver,
args: [deployer]
};
const fn = Require.file(requireOptions);
const unRunnable = !fn || !fn.length || fn.length == 0;
if (unRunnable) {
const msg = `Migration ${
this.file
} invalid or does not take any parameters`;
throw new Error(msg);
}
// `migrateFn` might be sync or async. We negotiate that difference in
// `execute` through the deployer API.
const migrateFn = fn(deployer, options.network, accounts);
await this._deploy(options, deployer, resolver, migrateFn);
}
// `--compile`
if (options.c || options.compile) {
return Contracts.compile(config, function(err) {
if (err) return done(err);
Require.exec(
config.with({
file: file
}),
done
);
});
}
// Just exec
Require.exec(
config.with({
file: file
}),
done
);
})
.catch(error => {