paint-brush
Hack Solidity: Integer Overflow and Underflowby@kamilpolak
14,302 reads
14,302 reads

Hack Solidity: Integer Overflow and Underflow

by Kamil Polak2mJanuary 17th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow
EN

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
Kamil Polak

Kamil Polak

@kamilpolak

I am a huge enthusiast of cryptocurrency and blockchain technology.

About @kamilpolak
LEARN MORE ABOUT @KAMILPOLAK'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Kamil Polak HackerNoon profile picture
Kamil Polak@kamilpolak
I am a huge enthusiast of cryptocurrency and blockchain technology.

TOPICS

Languages

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite