How to use @truffle/compile-solidity - 3 common examples

To help you get started, we’ve selected a few @truffle/compile-solidity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / core / lib / version.js View on Github external
let bundleVersion;
  // NOTE: Webpack will replace BUNDLE_VERSION with a string.
  if (typeof BUNDLE_VERSION != "undefined") bundleVersion = BUNDLE_VERSION;

  let supplierOptions;
  if (config && config.compilers) {
    supplierOptions = {
      events: config.events,
      solcConfig: config.compilers.solc
    };
  } else {
    const { events, compilers } = new Config();
    const solcConfig = compilers.solc;
    supplierOptions = { events, solcConfig };
  }
  const supplier = new CompilerSupplier(supplierOptions);

  return {
    core: pkg.version,
    bundle: bundleVersion,
    solc: supplier.version
  };
};
github b-mueller / sabre / lib / controllers / analyze.js View on Github external
const { solcSnapshot, fromCache } = await compiler.loadSolcVersion(
            releases[version]
        );

        spinner.succeed(
            fromCache
                ? `Loaded solc v${version} from local cache`
                : `Downloaded solc v${version} and saved to local cache`
        );

        spinner.start('Resolving imports');

        /**
         * Resolve imported sources and read source code for each file.
         */
        const resolvedSources = await Profiler.resolveAllSources(
            resolver,
            [solidityFilePath],
            solcSnapshot
        );

        spinner.stop();

        spinner.start('Compiling source(s)');

        const allSources = {};

        for (const file in resolvedSources) {
            allSources[file] = { content: resolvedSources[file].body };
        }

        /* Get the input config for the Solidity Compiler */
github trufflesuite / truffle / packages / compile-vyper / index.js View on Github external
compile.necessary = function(options, callback) {
  options.logger = options.logger || console;

  Profiler.updated(options, function(err, updated) {
    if (err) return callback(err);

    if (updated.length === 0 && options.quiet !== true) {
      return callback(null, [], {});
    }

    options.paths = updated;
    compile.with_dependencies(options, callback);
  });
};

@truffle/compile-solidity

Compiler helper and artifact manager for Solidity files

MIT
Latest version published 1 year ago

Package Health Score

53 / 100
Full package analysis