Content pfp
Content
@
0 reply
0 recast
0 reaction

Paul Vijender pfp
Paul Vijender
@paulvijender
Attack vector #2 on this list - Rounding errors. Rounding errors can be a tricky pitfall for developers. Some best practices and guidance below to avoid attacks stemming from these errors. πŸ‘‡
1 reply
0 recast
2 reactions

Paul Vijender pfp
Paul Vijender
@paulvijender
2/ First up: Understanding the problem. Solidity doesn't handle decimals like traditional programming languages. Instead, it uses fixed-point math, meaning we need to think differently about arithmetic operations to avoid precision loss.
1 reply
0 recast
0 reaction

Paul Vijender pfp
Paul Vijender
@paulvijender
3/ Use SafeMath, ABDK and FixedPoint libraries. While Solidity 0.8.x auto-prevents overflow and underflow, SafeMath can still help with explicit rounding control. It's a must for versions before 0.8 and a good practice for clarity and explicitness in your code.
1 reply
0 recast
2 reactions