0
function payWorker1(address schoolId) public payable returns(bool){
        require(Schools[schoolId].moneySent == false);
        require(Schools[schoolId].verified == true);
        Schools[schoolId].accountCaterar.transfer(Schools[schoolId].amountRequired*(caterar/100));
        Schools[schoolId].accountTransporter.transfer(Schools[schoolId].amountRequired*(transporter/100));
        Schools[schoolId].accountSupplier.transfer(Schools[schoolId].amountRequired*(materialSupplier/100));
        Schools[schoolId].moneySent = true;
        return true;
    }

But works fine when I just transfer to one account and without calculation. And function works properly just the amount is not transferred from the contract.

  • I would start with some debugging logs to output the calculations. We don't see enough of the contract to spot the problems. There are, at least, four variables and a set of accounts (array or mapping) that could be related to the problem. Consider showing a complete, small experimental contract that manifests the problem and the exact inputs someone needs to use to replicate the problem. – Rob Hitchens - B9lab May 18 at 20:21
  • Do the division last, not first! – goodvibration May 19 at 7:51

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.