index.js
function deploy(contract, callback, contractMap) {
  // Reuse existing contract address
  if (config.deployedContracts.hasOwnProperty(contract.name)) {
    contract.address = config.deployedContracts[contract.name];
    return callback(null, contract);
  }

  linkBytecode(contract, contractMap);

  // Deploy a new one
  var params = resolveConstructorParams(contract, contractMap);
  logDebug('Constructor params ' + contract.name + ':', params);
  if(contract.bytecode && !contract.bytecode.startsWith('0x')) {
    contract.bytecode = '0x' + contract.bytecode;
  }
  params.push({
    from: config.from,
    data: contract.bytecode,
    gas: config.gasLimit,
  });
  params.push(function (err, deployed) {
    if (err) {
      return callback(err);
    }
    if (typeof deployed.address !== 'undefined') {
      contract.address = deployed.address;
      return callback(null, contract);
    }
  });

  var web3Contract = web3.eth.contract(contract.abi);
  web3Contract.new.apply(web3Contract, params);
}
function deploy(contract, callback, contractMap) {
  // Reuse existing contract address
  if (config.deployedContracts.hasOwnProperty(contract.name)) {
    contract.address = config.deployedContracts[contract.name];
    return callback(null, contract);
  }

  linkBytecode(contract, contractMap);

  // Deploy a new one
  var params = resolveConstructorParams(contract, contractMap);
  logDebug('Constructor params ' + contract.name + ':', params);
  if(contract.bytecode && !contract.bytecode.startsWith('0x')) {
    contract.bytecode = '0x' + contract.bytecode;
  }
  params.push({
    from: config.from,
    data: contract.bytecode,
    gas: config.gasLimit,
  });
  params.push(function (err, deployed) {
    if (err) {
      return callback(err);
    }
    if (typeof deployed.address !== 'undefined') {
      contract.address = deployed.address;
      return callback(null, contract);
    }
  });

  var web3Contract = web3.eth.contract(contract.abi);
  web3Contract.new.apply(web3Contract, params);
}
function deploy ( contract , callback , contractMap ) { // Reuse existing contract address if ( config . deployedContracts . hasOwnProperty ( contract . name ) ) { contract . address = config . deployedContracts [ contract . name ] ; return callback ( null , contract ) ; } linkBytecode ( contract , contractMap ) ; // Deploy a new one var params = resolveConstructorParams ( contract , contractMap ) ; logDebug ( 'Constructor params ' + contract . name + ':' , params ) ; if ( contract . bytecode && ! contract . bytecode . startsWith ( '0x' ) ) { contract . bytecode = '0x' + contract . bytecode ; } params . push ( { from : config . from , data : contract . bytecode , gas : config . gasLimit , } ) ; params . push ( function ( err , deployed ) { if ( err ) { return callback ( err ) ; } if ( typeof deployed . address !== 'undefined' ) { contract . address = deployed . address ; return callback ( null , contract ) ; } } ) ; var web3Contract = web3 . eth . contract ( contract . abi ) ; web3Contract . new . apply ( web3Contract , params ) ; }
Deploy contracts, if it is not already deployed
Deploy contracts if it is not already deployed