1

When deploying a contract, my transaction fails (flag status set to 0) and all gas is marked as used. What could be the possible reasons?

Any help appreciated

Edit with the solidity code in question (which is a very simple token contract) :

pragma solidity ^0.4.24;


contract MinimumToken {
    // Fields
    mapping(address => uint256) balanceOf;
    uint256 total;
    address[] participants;

    // Constructor
    constructor (address from, uint256 _total) public {
        total = _total;
        balanceOf[from] = total;
    }

    // Public functions
    function transferFrom (address from, address to, uint256 amount) public {
        require(!(to == address(0)), "error");
        require(!(from == to), "error");
        require(amount <= balanceOf[from], "error");

        balanceOf[from] = balanceOf[from] - amount;
        balanceOf[to] = balanceOf[to] + amount;

    }
}
  • 1
    You might have some sort of high order process in your constructor, may be an infinite loop. It'll be helpful to debug if you can post your code. – sp4c3 Jan 28 at 11:45
  • 1
    I'm able to deploy contract in Remix, what is your gas limit ? also what parameters are you sending to constructor? – sp4c3 Jan 28 at 12:04
  • The error was very simple : I was not sending any parameters when deploying the contract. I now need to know how to pass the constructor parameters using the NewContractCreation function in the types package. But will probably create new thread. Thank you for your help. – Solerus Jan 28 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.