Code With No Effects

In Solidity, it's possible to write code that does not produce the intended effects.

Let's see an example:

Alt text

The line

has an error which is very unpleasant. Instead the right way is to assign the amount to the balance of the msg.sender, like this:

Alt text

Another bad example is this code snippet:

Alt text

As you can see, here we are not checking the return value of the call on this line:

And the fix is the following:

Alt text

Last updated