0

has someone knows what should be fixed on the below Solidity code?

require (_value%100 == 0);
uint fee = _value/1000; // for 1% fee
require (balanceOf[msg.sender] > _value) ;
require (balanceOf[_to] + _value > balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += (_value-fee);
balanceOf[thirdPartyAddress] += value;

I'm currently using the solidity 4.26 and this is showing the following error: ParserError: Expected identifier but got '(' require (_value%100 == 0); ^

Any comment is welcomed :)

1
  • Hi there. Is this code inside a function? Can you please edit your question to include all the code? Apr 21 at 19:36
1

It's difficult to say, given that you haven't included all of the code.

It looks like the above code hasn't been written inside a function...

Once that's fixed, there's also an error on this line:

balanceOf[thirdPartyAddress] += value;

value should be _value.

0

thanks a lot by your answer! This is the only piece of the code that is being accusing an error. Actually, error is happening only on the lines mentioning "require".

Thanks in advance by the help!

1
  • 1
    Okay, thanks for the details. The error will be before the first require line, so we need to see the previous lines of code. Also, this code must be inside a function. Apr 21 at 20:00

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.