GitHub File Link

I can compile and deploy CredentialOrgFactory, and compile CredentialFactory but not deploy

REMIX error:   
    creation of CredentialFactory pending...  
    [vm]from:0xca3...a733cto:CredentialFactory.(constructor)value:0 wei data:0x608...a0029logs:0hash:0xcbc...d4427  
 status     0x0 Transaction mined but execution failed transaction hash     0xcbcb460efa2e16890b55d82058b4a152213fc1b38c719f389b57b9b3e81d4427  
 contract address   0x5e72914535f202659083db3a02c984188fa26e9f  
 from   0xca35b7d915458ef540ade6068dfe2f44e8fa733c  
 to     CredentialFactory.(constructor)  
 gas    3000000 gas  

 transaction cost   927345 gas   
 execution cost     35597 gas   
 hash   0xcbcb460efa2e16890b55d82058b4a152213fc1b38c719f389b57b9b3e81d4427  
 input  0x608...a0029  
 decoded input  {}  
 decoded output      -   
 logs   []  
 value  0 wei  

VM error: revert.  
revert  The transaction has been reverted to the initial state.  
Note: The constructor should be payable if you send value.  Debug the transaction to get more information.  

the truffle error on migrate:
Running migration: 2_deploy_contracts.js  
  Deploying CredentialOrgFactory...  
  ... 0xc044d4c153739733aedc33dcb41b66de989e4451b41011b14aae69a8070119a9  
Error encountered, bailing. Network state unknown. Review successful transactions manually.  
Error: The contract code couldn't be stored, please check your gas amount.  

    module.exports = {  
      // See <http://truffleframework.com/docs/advanced/configuration>  
      // for more about customizing your Truffle configuration!  
      networks: {  
        development: {  
          host: "",  
          port: 8545,  
          network_id: "*" // Match any network id  

Deploy file:  
var CredentialOrgFactory = artifacts.require("CredentialOrgFactory");  
var CredentialFactory = artifacts.require("CredentialFactory");  
var ApplicantFactory = artifacts.require("ApplicantFactory"); 
module.exports = async function(deployer) {  
    let aInst, bInst;  

    await Promise.all([  

    instances = await Promise.all([  

    aInst = instances[0];  
    bInst = instances[1];  

    results = await Promise.all([  

It is likely failing during the deployment in the execution of your constructor.

Within the constructor, you call:

createCredential("A", "Associate Degree in Basket Weaving", "BA - Arts");

This ends up running:

CredentialOrgFactory cof = CredentialOrgFactory(credentialOrgContractAddress);
if (cof.isCredentialOrg(msg.sender)){

At this point, credentialOrgContractAddress has not been initialized. It is the default value of 0x0. When you try to call the isCredentialOrg() method on it, you're actually invoking it on the zero address, which would result in a revert since that's not actually a contract.

| improve this answer | |
  • Thank you! I KNEW it was something i was MISSING in the 'flow'. – shaddow Aug 10 '18 at 17:08
  • that was it, appreciate! – shaddow Aug 10 '18 at 17:26
  • Glad to hear it! Feel free to mark the answer as accepted – Raghav Sood Aug 10 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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