1
   function allowServiceProvider(bytes32 _name,uint _votes) ifDivOptExecuted {
    // CSD can allow a service provider to submit its customers votes
    if(_votes > divOpt.votingRightsMax - divOpt.votingRightsUsed){
      // throw in case you give more votes to the service provider than allowed
      throw;
    }
    // used to dynamically map index to structure in array of structs
    // to be refactored..
    address _sp =msg.sender;
    providerOf[_sp].name = _name;
    providerOf[_sp].votingRightsMax =_votes;
    providerOf[_sp].votingRightsUsed = 0;
    providerOf[_sp].active = true;
    SpStatus('Service Provider allowed by CSD (name,votes)',_name,_votes);
  }

THE TRANSACTION IS CALLED LIKE THIS:

DividendOptionContract.deployed().then(function(instance)
  {
    return instance.allowServiceProvider(name,votes,{from:web3.eth.accounts[5]
});
  }).then(function(result)
         {
            save_th(result.tx,type)
            console.log("done");

         }).catch(function(e){
           console.log(e);

         });
3
  • What are divopt and ifDivOptExecuted? It's very likely this is throwing by design. Jul 5 '17 at 5:33
  • IfdivOptexecuted is a modifier which checks if a value is true (which i have set to true) and the if condition will evaluate to false i am sure of that ! Jul 5 '17 at 5:36
  • I debugged the error. Too much gas was being used because of the number of assignments and operations. when i commented out the event catcher the code worked perfectly ! Jul 5 '17 at 6:19
0

I debugged the error. Too much gas was being used because of the number of assignments and operations. when i commented out the event catcher the code worked perfectly !

1
  • Hi after the delay please accept your own answer
    – Badr Bellaj
    Jul 5 '17 at 12:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.