@PatrickAlphaC I watched the Solidity on YT. Last time (weeks ago) tried to watch Foundry on your site but the site had issues. I use mainly Vivaldi, Opera, Brave browsers.
🛡 SOLIDITY TIP OF THE DAY 🛡
If you are building smart contracts on the Ethereum Virtual Machine, today's tip will help make your code more secure.
The latest minor semantic version of Solidity, 0.8.X, introduced built-in safe arithmetics by default which has been considered a boon by the security community.
Did you know, however, that these built-in safe arithmetics do not cover casting operations?
Any casting operation from a higher-bit accuracy to a lower-bit accuracy can result in data loss of the upper bits that have been removed.
It is always advisable to perform these type casts safely, ensuring that the data being cast will fit to the expected type under all circumstances.
As always, follow @Omniscia_sec for daily Solidity tips 🔔
🛡️ SOLIDITY TIP OF THE DAY 🛡️
As storage reads are inherently expensive in the EVM, it is always advisable to cache storage-level variables to memory whenever they are meant to be utilized multiple times.
Doing so can lead to significant gas savings, shaving off the cost of one warm SLOAD per replaced instance if a memory variable is utilized in its place.
Caution should be taken when applying this optimization to ensure that the correct value is being utilized in the code at all times!
#crypto #DeFi #Web3 #Ethereum
SOLIDITY TIP OF THE DAY 💡
In the world of #cryptocurrencies, efficient coding is crucial for performance and cost-effectiveness, especially on the Ethereum blockchain.
Here is a quick tip you can apply, to optimize some of the most expensive operations in the EVM; reading and writing data from and to storage respectively.
Minimizing these operations should be a priority for any developer, and what better tool to use than Solidity's own tight-packing mechanism.
As each storage operation will utilize 32-bytes regardless of the underlying type, Solidity will try to optimize them by treating multiple sub-256 bit data types as a single 32-byte slot.
To do so, Solidity relies on the order of variables and it is always important to order them in such a way to achieve tightly-packed slots!
As a caveat, apply this optimization solely when the variables are expected to be read from and written to in tandem as otherwise, an increase in gas may ultimately result.
For everybody who has some questions about how to work with #Git and @Github. @LarryCutts6 from @LearnWeb3DAO we have seen an overview on the basics today.
Some extra links that I'll share:
How to setup SSH
Search for Repos
How to contribute to a project
Todo: still need to test the VotingSystem contract from @eattheblocks, however with my new knowledge from @ProgrammerSmart I'm sure I can handle the #FOUNDRY test now.