I am deploying a contract using truffle, and when I specify the gas limit as the gas I want to use for the transaction I always get the exceeds gas limit error. Why does this happen?
edit What I am trying to do is deploy the crypto kitties KittyCore.sol contract to my local devnet. I am using truffle to deploy it.
From another page, How to deploy truffle contract to dev network when using inheritance?, I found that since there is a contract hierarchy, I need to deploy my contracts in order. I used this technique, and I am able to deploy 4 out of 7 contracts, with the fifth, KittyAuction, giving the following error: The contract code couldn't be stored, please check your gas amount
Posted below is my truffle deployer script
var KittyCore = artifacts.require("KittyCore");
var KittyMinting = artifacts.require("KittyMinting");
var KittyAuction = artifacts.require("KittyAuction");
var KittyBreeding = artifacts.require("KittyBreeding");
var KittyOwnership = artifacts.require("KittyOwnership");
var KittyBase = artifacts.require("KittyBase");
var KittyAccessControl = artifacts.require("KittyAccessControl");
var SaleClockAuction = artifacts.require("SaleClockAuction");
module.exports = function (deployer) {
deployer.deploy(KittyAccessControl).then(function () {
return deployer.deploy(KittyBase).then(function () {
return deployer.deploy(KittyOwnership).then(function () {
return deployer.deploy(KittyBreeding).then(function () {
return deployer.deploy(KittyAuction, {
gas: 400000
}).then(function () {
return deployer.deploy(KittyMinting).then(function () {
return deployer.deploy(KittyCore);
})
})
})
})
})
});
};
My gas limit is set to 18000000000. This gas number is produced by running the following function on the actual contract that fails to deploy
var gasPrice;
KittyAuction.web3.eth.getGasPrice(function (error, result) {
gasPrice = Number(result);
console.log(gasPrice);
})
I have been fiddling with this number and nothing seems to work.