0

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  
    Debug  
 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.  

Config:  
    module.exports = {  
      // See <http://truffleframework.com/docs/advanced/configuration>  
      // for more about customizing your Truffle configuration!  
      networks: {  
        development: {  
          host: "127.0.0.1",  
          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([  
      deployer.deploy(CredentialOrgFactory),  
      deployer.deploy(CredentialFactory)  
    ]);  

    instances = await Promise.all([  
        CredentialOrgFactory.deployed(),  
        CredentialFactory.deployed()  
    ])  

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

    results = await Promise.all([  
      bInst.setAddress(aInst.address)  
    ]); 
0

1 Answer 1

2

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.

2
  • Thank you! I KNEW it was something i was MISSING in the 'flow'.
    – shaddow
    Commented Aug 10, 2018 at 17:08
  • that was it, appreciate!
    – shaddow
    Commented Aug 10, 2018 at 17:26

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.