var CredentialOrgFactory = artifacts.require("CredentialOrgFactory");
var CredentialFactory = artifacts.require("CredentialFactory");
var ApplicantFactory = artifacts.require("ApplicantFactory");
//var ProcessCredentials = artifacts.require("ProcessCredentials");

module.exports = async(deployer) => {
    let deployCredentialOrgFactory = await deployer.deploy(CredentialOrgFactory);
    let deployCredentialFactory = await deployer.deploy(CredentialFactory);
    contractCredentialFactory = await CredentialFactory.deployed()
    let setAddress = await contractTwo.setAddress(
        { gas: 200000 }

with the message:

(node:13120) UnhandledPromiseRejectionWarning: Error: VM Exception while processing transaction: revert
//some unimportant stuff //
(node:13120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

what is the proper coding in the 2_deploy_contracts.js file? maybe i'm not setting the address of CredentialFactory properly? thoughts? i'm a bit stuck atm.

it could be part of the test file.
pragma solidity ^0.4.21;

import "truffle/Assert.sol";  
import "truffle/DeployedAddresses.sol";  
import "../contracts/CredentialFactory.sol";  

contract TestCredentialFactory {  
CredentialFactory credentialFactory = CredentialFactory(DeployedAddresses.CredentialFactory());  

    function testIsActiveValid() public {  
        bool r = credentialFactory.isCredentialActive(0x2259aA88Cc0aa3d83d5ec5aF6096C627778FBD06, 0);  
        Assert.isTrue(r, "Valid isActive Test.");  

    function testIsActiveInvalid() public {  
        bool r = credentialFactory.isCredentialActive(0x5a186B7FeC36909678211F69beB67EC3b1E4fFBB, 5);  
        Assert.isFalse(r, "Outside Range IsActive Test");  
    function SelectOrgCredentialCount() public {  
        uint256 testVal = uint256(credentialFactory.SelectOrgCredentialCount(0x2259aA88Cc0aa3d83d5ec5aF6096C627778FBD06));  
        uint256 expected = 1;  
        Assert.equal(testVal, expected, "Expected Credential Count (1)");  

  • Async/await are not supported in deployment scripts, see comment from developers github.com/trufflesuite/truffle/issues/…
    – Ismael
    Commented Aug 9, 2018 at 23:56
  • Thanks, working on it now, came across another issue, maybe you would be willing to try your hand at this problem
    – shaddow
    Commented Aug 10, 2018 at 16:16

2 Answers 2


Not an answer to your specific question, but it could resolve it:

Currently I am using this library: https://github.com/LimeChain/etherlime to deploy contracts it works with async/await and has a nice reporting at the end of each deploy. Currently it even support testing like truffle's. It is a bit more stable and predictable with using ethersjs under the hood than the web3js.

  • thanks for the answer, is a course project, and so can't use that.
    – shaddow
    Commented Aug 10, 2018 at 16:17

This layout clears things up and allows the waits to happen.

var CredentialOrgFactory = artifacts.require("CredentialOrgFactory");  
var CredentialFactory = artifacts.require("CredentialFactory");  
var ApplicantFactory = artifacts.require("ApplicantFactory");  
//var ProcessApplicants = artifacts.require("ProcessApplicants");  

module.exports = async function(deployer, accounts) {  
    let aInst, bInst, cInst, dInst;
    let aAccount;

await Promise.all([
  // deployer.deploy(ProcessApplicants)

instances = await Promise.all([

aInst = instances[0];
bInst = instances[1];
cInst = instances[2];
//dInst = instances[3];

results = await Promise.all([
  //dInst.setAddress(aInst.address, bInst.address, cInst.address)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.