I have managed to successfully compile a solidity token contract, the constructor is shown below :
function token(uint256 initialsupply, string symbol, string name, uint256
buyPrice, uint256 sellPrice) public {
totalSupply = initialsupply * 10**decimals;
tokenBalance[msg.sender] = totalSupply;
tokenSymbol = symbol;
tokenName = name;
buyprice = buyPrice;
sellprice = sellPrice;
require(buyprice <= sellprice);
owner = msg.sender;
When using truffle to migrate and deploy the contract I run into an error which is
Error: VM Exception while processing transaction: revert
Here is the deploy_contracts.js :
var token = artifacts.require("./token.sol");
var newtoken = artifacts.require("./newtoken.sol");
module.exports = function(deployer) {
deployer.deploy(token, 10000, "TOK", "ExampleToken", 20, 10);
deployer.link(token,newtoken);
deployer.deploy(newtoken);
};
However, when I add an additional sixth parameter to the constructor in my contract and then deploy the contract with only the above 5 parameters inputted in deploy_contract.js, the contract has no problems migrating the blockchain. So my constructor is now :
function token(uint256 initialsupply, string symbol, string name, uint256 buyPrice, uint256 sellPrice, uint256 dummy) public {
Is this an issue with truffle when deploying contracts ?
I am using truffle ganache 1.0.0