Tag: smart-contract

  1. Updated

    Solidity: Multicall - Aggregate Multiple Contract Calls

    Category: Blockchain

    The main idea of Multicaller is to aggregate multiple contract function calls into a single one. It's usually to batch contract reads from off-chain apps. However, it could also be used to batch contract writes.

  2. Updated

    Demystifying Solidity ABI Encoding

    Category: Blockchain

    There are many encode functions in Solidity: abi.encode(), abi.encodePacked(), abi.encodeWithSignature(), and abi.encodeCall(). Which one to use, and when.

  3. Updated

    Solidity: Read Contract Storage by Slots with Foundry

    Category: Blockchain

    State variables are stored in different "slots" in a contract, and each slot is 32 bytes (256 bits). However, multiple adjacent state variables declared in the contract may be packed into the same slot by the Solidity compiler if their combined size does not exceed 32 bytes.

  4. Updated

    Solidity: CREATE vs CREATE2

    Category: Blockchain

    How to deploy a contract using `CREATE2` which is introduced in EIP-1014 to provide more flexible address generation.

  5. Updated

    Solidity: calldata, memory, and storage

    Category: Blockchain

    If you can, try to use calldata as data location because it will avoid copies, reduce gas usage, and also make sure that the data cannot be modified.

  6. Updated

    hardhat-deploy: Upgradeable Contracts with Linked Libraries

    Category: Blockchain

    Whenever the library is changed, hardhat-deploy will deploy a new implementation and upgrade the proxy.