I wanted to follow the tutorial - https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 - but there was a new release - https://github.com/OpenZeppelin/zeppelin-solidity/releases/tag/v1.7.0 - so I'm trying to figure it out...
Actual code is verified on Etherscan.
Crowdsale: https://ropsten.etherscan.io/address/0x018ea8f3fef7bd14c7bff98e898842925f05e6ea#code
Coin: https://ropsten.etherscan.io/address/0x37ca578d3d847d27741b2ffc033419a7d11b7bef#code
My account sending ETH to crowdsale: https://ropsten.etherscan.io/address/0x85a363699c6864248a6ffca66e4a1a5ccf9f5567
Transaction hash: https://ropsten.etherscan.io/tx/0x7f99bca20b767073eb48ed2e6d01186c55bcc97ee8316523977e15c4286f6c5a
Here is a short video of me explaining what I'm doing: https://youtu.be/oKP9ea5PNho
Looking at the code: https://github.com/OpenZeppelin/zeppelin-solidity/blob/3c489127306d09dc08c6a22263134fb5413d2f80/contracts/crowdsale/Crowdsale.sol#L48
function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public
I instantiate coin and crowdsale in the following way:
contract MailHustleCrowdsale is Crowdsale {
uint256 _rate = 1000;
address _wallet = 0x315f80c7caacbe7fb1c14e65a634db89a33a9637;
ERC20 _token = new MailHustleCoin();
function MailHustleCrowdsale() Crowdsale(_rate, _wallet, _token) {
}
}
My guess is that the error is somewhere here but cannot figure the working syntax...
Alternative approach:
How to reference coin contract already onchain?
If including the original source code isn't practical, an easy way to work around it is just to make a stub contract above your own contract containing the function signature of the function you want to call.
For simplicity I've decided to include everything in a single file.