Ch17 library contract

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:

Ch18 Import

Summary of Mistakes I made during the test

Ch19 Receive ETH

Before Solidity 0.6.x

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().

<aside> 💡

Gas Considerations

Two situations sending ETH:

  1. using 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.
  2. using 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>