Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let compiledContract = solc.compile(source, 1);
let abi = compiledContract.contracts[':Fundraiser'].interface;
let bytecode = compiledContract.contracts[':Fundraiser'].bytecode;
let MyContract = web3.eth.contract(JSON.parse(abi));
// Fundraiser takes some arguments to assign control and begin/end blocks
cli.parse({
admin: [ 'a', 'Admin address', 'string', "" ],
treasury: [ 't', 'Treasury address', 'string', ""],
begin: [ 'b', 'Begin block', 'int', 0],
end: [ 'e', 'End block', 'int', 0],
weiPerAtom: [ 'r', 'Initial atom rate', 'int', 0],
});
var admin = cli.options.admin;
var treasury = cli.options.treasury;
var beginBlock = cli.options.begin;
var endBlock = cli.options.end;
var weiPerAtom = cli.options.weiPerAtom;
// output the gas and tx data to deploy the contract
var deployData = MyContract.new.getData(admin, treasury, beginBlock, endBlock, weiPerAtom, {data:bytecode});
txObject = {
gas: 800000,
data: "0x"+deployData
}
console.log(JSON.stringify(txObject));
let bytecode = compiledContract.contracts[':Fundraiser'].bytecode;
let MyContract = web3.eth.contract(JSON.parse(abi));
// Fundraiser takes some arguments to assign control and begin/end blocks
cli.parse({
admin: [ 'a', 'Admin address', 'string', "" ],
treasury: [ 't', 'Treasury address', 'string', ""],
begin: [ 'b', 'Begin block', 'int', 0],
end: [ 'e', 'End block', 'int', 0],
weiPerAtom: [ 'r', 'Initial atom rate', 'int', 0],
});
var admin = cli.options.admin;
var treasury = cli.options.treasury;
var beginBlock = cli.options.begin;
var endBlock = cli.options.end;
var weiPerAtom = cli.options.weiPerAtom;
// output the gas and tx data to deploy the contract
var deployData = MyContract.new.getData(admin, treasury, beginBlock, endBlock, weiPerAtom, {data:bytecode});
txObject = {
gas: 800000,
data: "0x"+deployData
}
console.log(JSON.stringify(txObject));
interpret: function (args) {
cli.setArgv(args);
cli.options = {};
cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
var options = cli.parse(OPTIONS);
// Use config file if specified
var config;
if (options.config) {
config = exports.loadConfig(options.config);
}
switch (true) {
// JSLint reporter
case options.reporter === "jslint":
case options["jslint-reporter"]:
options.reporter = "./reporters/jslint_xml.js";
interpret: function(args) {
cli.setArgv(args);
cli.options = {};
cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
var options = cli.parse(OPTIONS);
// Use config file if specified
var config;
if (options.config) {
config = exports.loadConfig(options.config);
}
switch (true) {
// JSLint reporter
case options.reporter === "jslint":
case options["jslint-reporter"]:
options.reporter = "./reporters/jslint_xml.js";
function command() {
var opts = cli.options;
return [
"log",
"-p",
"--all",
"--no-merges",
`--since=${opts.since.format()}`,
`--until=${opts.until.format()}`,
"--reverse",
`--author=${author()}`,
`--pretty=format:"${opts.format}"`
];
}
let converter = new sass2less()
let files = []
cli
.enable('version', 'help', 'glob')
.setApp(__dirname + '/../package.json')
.setUsage('sass2less [source] filename-pattern')
.parse({
cwd: ['c', 'Resolve path names from this directory', 'string', '.'],
rename: ['r', 'Rename input files rather than creating converted copies', 'boolean', false]
})
if (!cli.args.length) {
cli.getUsage(1)
} else {
cli.options.pattern = cli.args.length > 1 ? cli.args.pop() : null
if (cli.args.length) {
files = cli.args.reduce(function(files, pattern) {
return files.concat(cli.glob.sync(path.join(cli.options.cwd, pattern)))
}, [])
}
if (!files.length) return cli.info('No files to convert found. Aborted!')
files.forEach(function(file) {
fs.stat(file, function(err, stats) {
if (stats.isFile()) {
fs.readFile(file, 'utf8', function(err, contents) {
if (err) return cli.error(err)
let result = converter.process(contents, { fileInfo: { filename: 'anything.scss' } })
getCommandLine = function() {
cli.enable('version', 'help');
cli.parse(options);
return cli.options;
};
function filename() {
var opts = cli.options;
var since = opts.since.format("YYYY-MM-DD");
var until = opts.until.format("YYYY-MM-DD");
var name = [unwrapScope(project()), "samples", since, "to", until]
.join("-")
.concat(".txt");
return path.join(opts.dest, name);
}
function persist (file, result) {
if (cli.options.pattern) {
let fileName = path.resolve(cli.options.cwd, parseFilePattern(cli.options.pattern, file, cli.options.cwd))
if (cli.options.rename === true) {
fs.rename(file, fileName, function(err) {
if (err) return cli.error(err)
fs.writeFile(fileName, result, function(err) {
if (err) return cli.error(err)
cli.ok(file + ' successfully converted and renamed')
})
})
} else {
mkdirp(path.dirname(fileName), function(err) {
if (err) return cli.error(err)
fs.writeFile(fileName, result, function(err) {
if (err) return cli.error(err)
function author() {
return (
cli.options.email || cli.options.name || user.git.email || user.git.name
);
}