How to use truffle - 5 common examples

To help you get started, we’ve selected a few truffle 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 smartcontractkit / LinkToken / full_suite.js View on Github external
{balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf000000000000000000000000000000000000000000000000000000000000005'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf000000000000000000000000000000000000000000000000000000000000006'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf000000000000000000000000000000000000000000000000000000000000007'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf000000000000000000000000000000000000000000000000000000000000008'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf000000000000000000000000000000000000000000000000000000000000009'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf00000000000000000000000000000000000000000000000000000000000000a'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf00000000000000000000000000000000000000000000000000000000000000b'},
    {balance: '0xffffffffffffffffffffffffffffffff', secretKey: '0xf00000000000000000000000000000000000000000000000000000000000000c'},
  ],
  // gasLimit: 100000000000,
  logger: { log: () => {} }
  // logger: console
});
global.provider = server.provider;

var config = Truffle.config.detect({
  test_files: [
    'test/TokenSale_spec.js',
    'test/SmartOracle_spec.js',
  ],
  provider: provider
})

server.listen(6323, () => {
  Truffle.test.run(config, process.exit);
});
github smartcontractkit / LinkToken / full_suite.js View on Github external
server.listen(6323, () => {
  Truffle.test.run(config, process.exit);
});
github trufflesuite / truffle / packages / truffle-solidity-loader / lib / build_option_normalizer.js View on Github external
normalize: function(buildOpts, query) {
    var truffleConfig = TruffleConfigLocator.find()

    if(truffleConfig) {
      var config = TruffleConfig.load(truffleConfig)
      config = merge(buildOpts, config)
    }

    if (query !== "undefined") {
      var config = QueryStringParser.parse(query)
      merge(buildOpts, config)
    }

    if(!buildOpts.network) {
      buildOpts.network = "default"
      Logger.log("Setting network to 'default' for compilation and contract provisioning")
    }

    if(!buildOpts.network_id) {
      buildOpts.network_id = "default"
      Logger.log("Setting network_id to 'default' for compilation and contract provisioning")
github ConsenSys / truffle-solidity-loader / index.js View on Github external
temp.mkdir('webpack-truffle', function(err, dirPath){
    if(!err) {
      var compilerOpts = {};
      compilerOpts.contracts_directory       = contractPath
      compilerOpts.contracts_build_directory = dirPath
      compilerOpts.network                   = buildOpts.network
      compilerOpts.network_id                = buildOpts.network_id
      compilerOpts.logger                    = Logger

      var provisionOpts = {}
      provisionOpts.provider                  = new Web3.providers.HttpProvider(buildOpts.web3_rpc_uri)
      provisionOpts.contracts_build_directory = dirPath

      TruffleContractCompiler.compile( compilerOpts, function(err, contracts){
        var migrationOpts = {}
        migrationOpts.migrations_directory      = buildOpts.migrations_directory
        migrationOpts.contracts_build_directory = dirPath
        migrationOpts.provider                  = provisionOpts.provider
        migrationOpts.network                   = compilerOpts.network
        migrationOpts.network_id                = compilerOpts.network_id
        migrationOpts.logger                    = Logger

        TruffleContractMigrator.run( migrationOpts, function( err, result ) {
          if(err) {
            Logger.error(err);
            return compilationFinished(err, null);
          }

          fs.readFile( path.resolve(dirPath, contractFileName+'.js'), 'utf8', function(err, solJsFile) {
            if(err) {
github ConsenSys / truffle-solidity-loader / index.js View on Github external
TruffleContractCompiler.compile( compilerOpts, function(err, contracts){
        var migrationOpts = {}
        migrationOpts.migrations_directory      = buildOpts.migrations_directory
        migrationOpts.contracts_build_directory = dirPath
        migrationOpts.provider                  = provisionOpts.provider
        migrationOpts.network                   = compilerOpts.network
        migrationOpts.network_id                = compilerOpts.network_id
        migrationOpts.logger                    = Logger

        TruffleContractMigrator.run( migrationOpts, function( err, result ) {
          if(err) {
            Logger.error(err);
            return compilationFinished(err, null);
          }

          fs.readFile( path.resolve(dirPath, contractFileName+'.js'), 'utf8', function(err, solJsFile) {
            if(err) {
              Logger.error(err);
              return compilationFinished(err, null);
            }

            compilationFinished(err, solJsFile)
          })
        })
      })
    }

truffle

Truffle - Simple development framework for Ethereum

MIT
Latest version published 1 year ago

Package Health Score

55 / 100
Full package analysis