I have a simple token derived from openzeppelin's MintableToken.
However, when I either add a Constructor OR another function, I am constantly running out of gas. But when I add ONLY one of both, either the Constructor OR the function, everything works fine.
My question is: how can I add several functions together with a constructor into my SmartContract?
The Token-Code:
pragma solidity ^0.4.22; import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; contract HaioToken is MintableToken { string public name = "Haio Token"; string public symbol = "HAI"; uint8 public decimals = 18; uint256 public cap; constructor(uint256 _cap) public { cap = _cap; } function test(address _to) public returns (bool) { return true; } } Migrations:
2_deploy_contracts.js:
var HaioToken = artifacts.require("HaioToken"); module.exports = function(deployer, network, accounts) { const hardCap = 25000000; return deployer .then(() => { return deployer.deploy(HaioToken, hardCap); }) }; When I want to deploy the code, I get the following error message:
Error: VM Exception while processing transaction: out of gas
If I remove either the constructor or the test-function, everything works fine.