1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I resolve "gas required exceeds allowance or always failing transaction" when trying...

Discussion in 'Finance' started by Nagen, Oct 8, 2018.

  1. Nagen

    Nagen Guest

    This is the sample smart contract I am trying to run. All methods work, except, "payVendor" - it fails with gas required exceeds allowance or always failing transaction . I have tried increasing the gas, but doesn't help.

    ontract vendorContract {

    uint public vendorID;
    uint public ownerID;
    uint256 public contractValue;
    string public contractDescription;
    string public contractStatus;
    string public paymentStatus;
    address public contractOwner;
    address public contractVendor;
    string constant newcon = "New";
    string constant wipcon = "WIP";
    string constant reqcon = "Requested";
    string constant shipcon = "Shipped";
    string constant endcon = "Completed";
    string constant err = "Error";


    modifier isOwner()
    {
    if (msg.sender != contractOwner) throw;
    _ ;
    }

    modifier isVendor()


    { if (msg.sender != contractVendor) throw; _ ; }

    function vendorContract(uint _vid, string _desc) public {
    vendorID = _vid;
    contractStatus="New";
    contractOwner=msg.sender;
    contractDescription= _desc;

    }

    function acceptContract(uint256 _cvalue, uint _vidd) public {
    if (vendorID != _vidd) {
    contractStatus = err;
    throw;
    }

    contractStatus=wipcon;
    contractValue = _cvalue;
    contractVendor = msg.sender;
    }

    function requestPayment() isVendor {
    paymentStatus=reqcon;
    contractStatus=shipcon;
    }

    function paymentStatus() returns (string) {
    return paymentStatus;
    }


    function payVendor() payable isOwner {
    if (!contractVendor.send(contractValue))
    throw;
    //contractVendor.send(contractValue);
    contractStatus = endcon;


    }


    }

    Login To add answer/comment
     

Share This Page