2

I have a smart Contract "RecommendContract" contains this method:

 function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) external  {

        Vacancy vacancy = vacancies[vacancyId];
        vacancy.incentive = incentive;
        vacancy.owner = sender;

        emit NewVacancy(vacancyId, incentive, sender );
    }

when I cal this method using web3 and nodejs it works fine. but when I call it using another smart contract it throws an errer : Revert

 function receiveApproval(address _sender, uint256 _value,
        address _tokenContract, bytes data) public {
        RecommendContract recommend = RecommendContract(0x4B3F6Bda49BdF8786554af1aD97D773C450375F0);

         uint8 serviceSelector = extractSelector(data);
          if (serviceSelector == 3) {
            // addVacancy
            emit LogEvent("ADD VACANCY SERVICE");
            bytes32 vacancyId = extractBytes32(data,1);
            bytes32 vacancyId = keccak256(data);
            uint256 incentive = extractUint256(data,33);
            recommend.addVacancy(_sender, vacancyId, _value);

        }



    }

NB: when I remove the ligne recommend.addVacancy(_sender, vacancyId, _value); it works.

  • Are you sure the address is correct? – Henk Aug 16 '18 at 15:40
  • I am sure, the one in the example isn't the real one ;) – maroodb Aug 16 '18 at 16:18
  • Do you have an example of a failing tx? – Raghav Sood Aug 16 '18 at 17:31

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.