3

I deployed multiple contracts of which some are linked to one another using truffle migration on the testrpc . In my web3 call for a function of one of the contract, instead of returning the current account address (according to logic implemented in the contract) it is returning 0x0. I guess something wrong with my contract or my contract not properly deployed on the testrpc network. I opened remix solidity IDE and using my local rpc network I tried to load the contract from the address (I got the address from the json file generated by truffle after migration.) But I get the same contract loaded for any addresses of any of the contracts. I am not sure if the only a single contract is deployed multiple times due to which web3 is not able to load other contracts or can there be any other reason for the method returning 0x0.

My migration code is :

var Category = artifacts.require("./Category.sol");
var CategoryCatalog = artifacts.require("./CategoryCatalog.sol");
var ConsentDirective = artifacts.require("./ConsentDirective.sol");
var Patient = artifacts.require("./Patient.sol");
var PatientFactory = artifacts.require("./PatientFactory.sol");

var name = "Category";
var who = "0xddf6d5d32547276d47fc9edcf725ed4e2008a4ef";
var what = 1;

module.exports = function(deployer) {
deployer.deploy(Category, name);

deployer.link(Category, CategoryCatalog);
deployer.deploy(CategoryCatalog);
deployer.deploy(ConsentDirective, who, what);
deployer.link(Category, Patient);
deployer.link(ConsentDirective, Patient);
deployer.deploy(Patient, who);

deployer.link(Patient, PatientFactory);
deployer.deploy(PatientFactory);
};

Any help will be highly appreciated. Thanks

  • 1
    How do you access the deployed contracts from web3? An address of 0x0 is very very unlikely, the migration script might have failed, or the contract instantiation in web3 is erroneous. – Ismael May 26 '18 at 3:31
  • @Ismael using the abi and network address from the generated json file after truffle migration. – M.Gupta May 26 '18 at 18:55
  • You cand edit your question and add the code of the contract instantiation. Try to narrow down your test to something that can be tested and fails. Your migrations script appear to be right but without seeing more code is hard to say that anything else. – Ismael May 27 '18 at 1:54

Your Answer

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

Browse other questions tagged or ask your own question.