I've created a simple Token.sol file, and a simple TokenCrowdsale.sol file, as well as a 2_deploy_contracts.js file. By simple, I mean I haven't changed much from the default that I imported, and I followed this guide mostly: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6
My issue is when I run truffle migrate --network development as I've defined in truffle.js, it gives me the error in the title. I've also set gas in truffle.js to 5000000. I'm using testrpc.
Follow this guide: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6
Run truffle compile
Set up a testrpc network
Set gas in truffle.rpc to 5000000
Run truffle migrate
Truffle migrate should complete without errors, and successfully deploy my Smart Contract to my testrpc network.
It failed to run the command with this error:
truffle migrate --network development
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts
Using network 'development'.
Running migration: 1_initial_migration.js
Replacing Migrations...
... 0x0fcfb99e1aabd106464c74ab56180d086472d1bfb5955a55cbdef00cde55e31f
Migrations: 0xfc2e6fbeacf68cfe910f02dfcc53a61db55777aa
Saving successful migration to network...
... 0xa80ecb06702cc81d525331c996d8039305e5335ab209d86803f314bdc92406ab
Saving artifacts...
Running migration: 2_deploy_contracts.js
Deploying EonTokenCrowdsale...
... 0xbf89a4c6238feb52246f8c4ccad59bc2ebbe2ff2b08742f88c8daeb980aa0f0e
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (/usr/lib/node_modules/truffle/build/cli.bundled.js:329221:46)
at /usr/lib/node_modules/truffle/build/cli.bundled.js:39618:25
at /usr/lib/node_modules/truffle/build/cli.bundled.js:331159:9
at /usr/lib/node_modules/truffle/build/cli.bundled.js:175492:11
at /usr/lib/node_modules/truffle/build/cli.bundled.js:314196:9
at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
You can also get this error message when trying to deploy an abstract contract. Perhaps you changed the signature of a function in any of your base contracts that could be "abstracting" the contract you are trying to deploy. So in fact, it may turn out to be not a matter of "checking your gas amount", as the error message suggests, but a matter of checking that you are not actually deploying an abstract contract.
@sputnik77 I am having this problem also. Can you define what you mean by an "abstract contract"?
Have a look to documentation here
I'm getting this error as well. @NateDev100 did this ever resolve for you?
Nope :(
On Tue, Dec 12, 2017 at 3:25 PM, Adrian Li notifications@github.com wrote:
I'm getting this error as well. @NateDev100
https://github.com/natedev100 did this ever resolve for you?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/667#issuecomment-351183212,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AeABonbZVDHPuddnuADaNibvrUe0bt-eks5s_uEzgaJpZM4QSNth
.
@NateDev100 This helped me resolve my problem, not sure if it'll help you: https://github.com/trufflesuite/truffle/issues/660#issuecomment-343066784
I am also facing the same issue in truffle 4. While trying to migrate a basic ICO smart contract.
OS - Ubuntu,
Finally it is working for me now.
Try adding the max gas while deploying in 2_deploy_contracts.js
deployer.deploy(Cont1, {gas: 6721975, from: "0xaddr"});
To get gaslimit 6721975, I used web3.eth.getBlock("pending").gasLimit.
Same here on:
Truffle v4.1.0 (core: 4.1.0)
Solidity v0.4.19 (solc-js)
I'm using the framework zeppelin-solidity, I have the same errors
and I have two contracts, one is extended CappedToken
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/CappedToken.sol";
contract GustavoCoin is CappedToken {
string public name = "GUSTAVO COIN";
string public symbol = "GUS";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 10000 * (10 ** decimals);
function GustavoCoin()
public
CappedToken(INITIAL_SUPPLY) {
}
}
And an other is crowd contract:
pragma solidity ^0.4.18;
import "./GustavoCoin.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
// import "../node_modules/zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
contract GustavoCoinCrowdsale is Crowdsale, TimedCrowdsale, CappedCrowdsale {
function GustavoCoinCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
uint256 _cap,
address _wallet,
StandardToken _token
) public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)
CappedCrowdsale(_cap) {
}
}
deploy javascripts content:
const GustavoCoin = artifacts.require('./GustavoCoin.sol');
const GustavoCoinCrowdsale = artifacts.require('./GustavoCoinCrowdsale.sol');
module.exports = async (deployer) => {
// 设定参数,此处的参数即使传入合约构造方法的参数,与合约保持一致
const beneficiary = '0xC0AE3D68Ce5df82aD0594B547Db6D5b2fbEFfaEd';
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days
const rate = 100;
const cap = 3000;
const tokenAddress = '0x784dc9e81d2f8dcb8f960baf6384387fdbadc5f4';
deployer.deploy(GustavoCoinCrowdsale,
web3.toBigNumber(startTime),
web3.toBigNumber(endTime),
web3.toBigNumber(rate),
web3.toBigNumber(cap),
beneficiary,
tokenAddress
);
};
truffle version information:
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)
error informations:
Running migration: 4_deploy_contracts.js
Replacing GustavoCoinCrowdsale...
... 0x931ea70ab49f385ddf0babc22053374a9b02bdcd66cfe75796a382822007bccd
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-migrate\index.js:225:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
@ccpwcn
My deployment was changed in order to work as follow:
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 28))/1000); // Today + 28 days
var exchangeRate = 2500; // 1 LEON = 0.0025 ETH or 1 ETH = 2500 LEON
return deployer
.then(() => {
return deployer.deploy(LeonardianToken);
})
.then(() => {
return deployer.deploy(
LeonardianCrowdsale,
startTime,
endTime,
exchangeRate,
"wallet adddress",
LeonardianToken.address
);
})
.then(() => {
var token = LeonardianToken.at(LeonardianToken.address);
token.transferOwnership(LeonardianCrowdsale.address);
});
@microdesign
I have already modify my deploy scripts when I receivied your reply:
const GustavoCoin = artifacts.require('./GustavoCoin.sol');
const GustavoCoinCrowdsale = artifacts.require('./GustavoCoinCrowdsale.sol');
return deployer.then(() => {
return deployer.deploy(GustavoCoin);
}).then(() => {
// 设定参数,此处的参数即使传入合约构造方法的参数,与合约保持一致
const beneficiary = '0xC0AE3D68Ce5df82aD0594B547Db6D5b2fbEFfaEd';
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days
const exchangeRate = 100; // 1 GUS = 0.001 ETH or 1 ETH = 100 GUS
const cap = 3000;
return deployer.deploy(GustavoCoinCrowdsale,
startTime,
endTime,
exchangeRate,
cap,
beneficiary,
GustavoCoin.address
);
}).then(() => {
var token = GustavoCoin.at(GustavoCoin.address);
token.transferOwnership(GustavoCoinCrowdsale.address);
});
BUT The script has a syntax error:
Running migration: 4_deploy_contracts.js
E:\code\solidity\tutorialToken\migrations\4_deploy_contracts.js:4
return deployer.then(() => {
^^^^^^
SyntaxError: Illegal return statement
at Object.createScript (vm.js:80:10)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-require\require.js:96:1
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
You miss some lines
module.exports = function(deployer, network, accounts) {
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 28))/1000); // Today + 28 days
var exchangeRate = 2500; // 1 LEON = 0.0025 ETH or 1 ETH = 2500 LEON
return deployer
.then(() => {
return deployer.deploy(LeonardianToken);
})
.then(() => {
return deployer.deploy(
LeonardianCrowdsale,
startTime,
endTime,
exchangeRate,
"wallet",
LeonardianToken.address
);
})
.then(() => {
var token = LeonardianToken.at(LeonardianToken.address);
token.transferOwnership(LeonardianCrowdsale.address);
});
};
@microdesign
Thank you very mush, your scripts is running well, and I still have an error, as a matter of fact, I've seen this mistake many times before, but I don't know why.
Running migration: 4_deploy_contracts.js
Running step...
Replacing GustavoCoin...
... 0x90e4ed09904ac9dc6f98dc60bd1d4833e41205e2142e493fcda0c457a28fa6d7
GustavoCoin: 0x5657e26deed4899e34e57e66d7bd4f91e8fc802f
Replacing GustavoCoinCrowdsale...
... 0x81c9640c7f1188c58fef21cc84b11c28641722082c3e287fd78566c56524ffc0
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-migrate\index.js:225:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
As you can see, Total two contracts, the first named GustavoCoin succeeded, but the second GustavoCoinCrowdsale failed.
This error is importent for me, Thank you very much for helping me solve these difficulties. Thank you again.
@ccpwcn No problem - I`m happy you solve your problem. Good luck with what you going to build.
@microdesign
So, I sincerely ask you, what happened to my code that caused the following error?
Running migration: 4_deploy_contracts.js
Running step...
Replacing GustavoCoin...
... 0x90e4ed09904ac9dc6f98dc60bd1d4833e41205e2142e493fcda0c457a28fa6d7
GustavoCoin: 0x5657e26deed4899e34e57e66d7bd4f91e8fc802f
Replacing GustavoCoinCrowdsale...
... 0x81c9640c7f1188c58fef21cc84b11c28641722082c3e287fd78566c56524ffc0
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-migrate\index.js:225:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Thank you again for guiding me to solve these problems. Thank you.
@ccpwcn I cant see your full code maybe making a repo or something. And we can eventually be blocked by a version problem which I was having one time.
@microdesign As you said, this is my codes:
A contract as an common token:
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/CappedToken.sol";
contract GustavoCoin is CappedToken {
string public name = "GUSTAVO COIN";
string public symbol = "GUS";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 10000 * (10 ** decimals);
function GustavoCoin()
public
CappedToken(INITIAL_SUPPLY) {
}
}
A contract as a crowdsale token:
pragma solidity ^0.4.18;
import "./GustavoCoin.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
// import "../node_modules/zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
contract GustavoCoinCrowdsale is Crowdsale, TimedCrowdsale, CappedCrowdsale {
function GustavoCoinCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
uint256 _cap,
address _wallet,
StandardToken _token
) public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_openingTime, _closingTime)
CappedCrowdsale(_cap) {
}
}
definination file for truffle framework that's name is truffle.js:
require('dotenv').config();
const Web3 = require("web3")
const web3 = new Web3();
const WalletProvider = require("truffle-wallet-provider");
const Wallet = require("ethereumjs-wallet");
var mainNetPrivateKey = new Buffer(process.env["MAINNET_PRIVATE_KEY"], "hex");
var mainNetWallet = Wallet.fromPrivateKey(mainNetPrivateKey);
var mainNetProvider = new WalletProvider(mainNetWallet, "https://mainnet.infura.io/");
var ropstenPrivateKey = new Buffer(process.env["ROPSTEN_PRIVATE_KEY"], "hex");
var ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey);
var ropstenProvider = new WalletProvider(ropstenWallet, "https://ropsten.infura.io/");
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// for more about customizing your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
},
ropsten: {
provider: ropstenProvider,
gas: 4600000,
gasPrice: web3.utils.toWei("20", "gwei"),
gasLimit: 46000000000000,
network_id: "3",
},
mainnet: {
provider: mainNetProvider,
gas: 4600000,
gasPrice: web3.utils.toWei("20", "gwei"),
network_id: "1",
}
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
},
};
project's package.json:
{
"name": "tutorialtoken",
"version": "1.0.0",
"description": "",
"main": "truffle.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.3.0"
},
"dependencies": {
"dotenv": "^6.0.0",
"ethereumjs-wallet": "^0.6.0",
"openzeppelin-solidity": "^1.10.0",
"truffle-wallet-provider": "0.0.5",
"web3": "^1.0.0-beta.30",
"zeppelin-solidity": "^1.7.0"
}
}
deploy scripts for truffle framework:
const GustavoCoin = artifacts.require('./GustavoCoin.sol');
const GustavoCoinCrowdsale = artifacts.require('./GustavoCoinCrowdsale.sol');
module.exports = function(deployer, network, accounts) {
return deployer.then(() => {
return deployer.deploy(GustavoCoin);
}).then(() => {
// 设定参数,此处的参数即使传入合约构造方法的参数,与合约保持一致
const beneficiary = '0xf3E57ab00bD9b225A1F35304F49eb812A2B6AD09';
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days
const exchangeRate = 100; // 1 GUS = 0.001 ETH or 1 ETH = 100 GUS
const cap = 3000;
return deployer.deploy(GustavoCoinCrowdsale,
startTime,
endTime,
exchangeRate,
cap,
beneficiary,
GustavoCoin.address
);
}).then(() => {
var token = GustavoCoin.at(GustavoCoin.address);
token.transferOwnership(GustavoCoinCrowdsale.address);
});
}
my action step:

truffle.cmd migrate --reset
Running migration: 4_deploy_contracts.js
Running step...
Replacing GustavoCoin...
... 0x3a082d503c779d47b0bfc38c5bff98de6e4ee44b1bb2ff46522fc4776b80c902
GustavoCoin: 0x03fb004aeffdda55bb4aaf8649f1a02dbf81638c
Replacing GustavoCoinCrowdsale...
... 0x08d7e936cafc367302d13aeacf73badce2e5365a3a3f9ec92f00b6284a8702f6
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:41483:16)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:330353:36
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176198:11
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:326008:9
at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:329052:7)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176427:18)
at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176717:12)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176872:12)
at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176832:24)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
As you see, the first contract GustavoCoin deployed succeeded and the second contract GustavoCoinCrowdsale deployed failed, I searched a lot of relative informations, but still cannot find real error reason.
I think you must remove Crowdsale
contract GustavoCoinCrowdsale is Crowdsale, TimedCrowdsale, CappedCrowdsale {
because CappedCrowdsale extends already the Crowdsale contract.
so write it this way
contract GustavoCoinCrowdsale is CappedCrowdsale, TimedCrowdsale {
This is just a suggestion but lets try it
@microdesign When I modified the codes:
pragma solidity ^0.4.19;
import "./GustavoCoin.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
// import "../node_modules/zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
// import "../node_modules/zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
// import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
contract GustavoCoinCrowdsale is TimedCrowdsale {
function GustavoCoinCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
ERC20 _token
) public TimedCrowdsale(_openingTime, _closingTime) {
rate = _rate;
wallet = _wallet;
token = _token;
}
}
And deploy scripts:
const GustavoCoin = artifacts.require('./GustavoCoin.sol');
const GustavoCoinCrowdsale = artifacts.require('./GustavoCoinCrowdsale.sol');
module.exports = function(deployer, network, accounts) {
const name = 'GUSTAVO TOKEN';
const symbol = 'GUS';
const totalSupply = 10000;
return deployer.then(function () {
return deployer.deploy(GustavoCoin,
name,
symbol,
totalSupply
);
}).then(function () {
// 设定参数,此处的参数即使传入合约构造方法的参数,与合约保持一致
const beneficiary = accounts[0];
const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days
const exchangeRate = 100; // 1 GUS = 0.001 ETH or 1 ETH = 100 GUS
return deployer.deploy(GustavoCoinCrowdsale,
startTime,
endTime,
exchangeRate,
beneficiary,
GustavoCoin.address
);
}).then(function () {
var token = GustavoCoin.at(GustavoCoin.address);
token.transferOwnership(GustavoCoinCrowdsale.address);
});
}
The errors still exists:
Running migration: 4_deploy_contracts.js
Running step...
Deploying GustavoCoin...
... 0x518b71dc716437ce149904aa496530889ad01c3de5cb4a88f0830d9faa2dabf5
GustavoCoin: 0x1a61350cbf81eb4275cbcbed01d87f1288331899
Deploying GustavoCoinCrowdsale...
... 0xb1386d791c4f3ce737c554e6f94905ff2f0a55e8a30a05d251eb4311dc3db422
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\web3\lib\web3\contract.js:147:1)
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\web3\lib\web3\method.js:142:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\web3\lib\web3\requestmanager.js:89:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\.-migrate\index.js:225:1
at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\.-provider\wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\web3\lib\web3\httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\xhr2\lib\xhr2.js:64:1)
at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\xhr2\lib\xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\xhr2\lib\xhr2.js:509:1)
at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\Users\gnidan\src\work\truffle\~\xhr2\lib\xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
The truffle.js networks section:
development: {
host: "127.0.0.1",
port: 7545,
from: "0xf3E57ab00bD9b225A1F35304F49eb812A2B6AD09",
network_id: "*" // Match any network id
}
@microdesign Thank you very much, My question has been solved
pragma solidity ^0.4.19;
import "./GustavoCoin.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "../node_modules/zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
contract GustavoCoinCrowdsale is Crowdsale, TimedCrowdsale {
function GustavoCoinCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _wallet,
address _tokenAddress
) public Crowdsale(_rate, _wallet, GustavoCoin(_tokenAddress)) TimedCrowdsale(_openingTime, _closingTime) {
}
}
@ccpwcn your code is not like I told you
MY
contract GustavoCoinCrowdsale is CappedCrowdsale, TimedCrowdsale {
YOUR
contract GustavoCoinCrowdsale is TimedCrowdsale {
@ccpwcn OK happy to hear this.
Having the same issue with a contract that is using Oraclize. Checked the contract code thousand times, there are no abstract functions there. However, I assume the issue is within the Oraclize contract itself using abstract functions, since I copy-pasted their API contract into my script file.
Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.
There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!
Most helpful comment
I am also facing the same issue in truffle 4. While trying to migrate a basic ICO smart contract.
OS - Ubuntu,
Finally it is working for me now.
Try adding the max gas while deploying in 2_deploy_contracts.js
deployer.deploy(Cont1, {gas: 6721975, from: "0xaddr"});
To get gaslimit 6721975, I used web3.eth.getBlock("pending").gasLimit.