Library contract is a special type of contract that enhances reusability and efficiency by providing a collection of functions that can be used across multiple contracts
There are two ways to use a library in Solidity:
using for :Strings: For converting numbers to strings.Address: To check if an address is a contract.Create2: For securely using the Create2 opcode to deploy contracts.Arrays: For array manipulation functions.Summary of Mistakes I made during the test
Before Solidity version 0.6.x, there was only one fallback() function that handled both ETH transfers and non-existing function calls. Starting with Solidity 0.6.x, the functionality was split into two separate functions: receive() and fallback().
receive() Functionfallback() Function<aside> 💡
Two situations sending ETH:
send or transfer, there is a gas limit of 2300 gas, which is very low. Therefore, it’s recommended not to execute too many complex operations inside receive(), as it might cause the transaction to run out of gas.call, the sender can specify the amount of gas to send, allowing more complex logic in receive(). However, this should be used carefully, especially to avoid gas-related attacks.
</aside>