Hack Solidity: Integer Overflow and Underflowby@kamilpolak
13,962 reads

Hack Solidity: Integer Overflow and Underflow

tldt arrow
EN
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

The easiest way to avoid overflow and underflow in Solidity is to use at least a 0.8 version of the Solidity compiler. In Solidity 0.7, the compiler will automatically take care of checking for overflows and underflows. Let's create a simple smart contract called "ChangeBalancesol" The initial balance is 0.0. If you press the "decrease" button, then the "balance" is decremented by one. Let’s see what happened next and how it works in practice.

Coin Mentioned

Mention Thumbnail
featured image - Hack Solidity: Integer Overflow and Underflow
Kamil Polak HackerNoon profile picture

@kamilpolak

Kamil Polak

I am a huge enthusiast of cryptocurrency and blockchain technology.


Receive Stories from @kamilpolak

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!