Year: 2021

  • All About msg.data in solidity

    msg.data or calldata store the data of the called function means calling function id, and its parameters in the form of bytes. here is an method: Now assume we pass call above method like this: This calldata or msg.data something like this. another example of calldata The idea here is to return the addition of…

  • Call other contract function through interface in solidity

    In this example the problem is that the address can be of an account or any other contract which will through an error. To solve this problem ERC-165 contract comes into play.

  • Delegatecall in solidity

    This is used to call other contract method but any change in states happened in the caller contract not in the targeted contract.

  • Gas Optimization in Solidity Smart Contract

    During deployment of a contract gas cost play a vital role. It increase the cost of a deployment cost. we can reduce it via inline assembly language check below example. Without inline assembly the gas cost of the below contract is 106299: With Assembly Language the gas cost of contract is: 105003

  • Bytes in Solidity

    There 2 Types of bytes: Fixed size bytes from (bytes1 to bytes32) dynamic bytes (with specific length)

  • keccak256 in solidity

    keccak256 returns hash of the given argument. It receives arguments with the type of bytes (not in the form of fixed bytes e.g bytes1 to bytes32). And returns hash of bytes32.

  • Verify Address of a Contract in Solidity

  • Eternal Upgradeable Pattern in Solidity

    Upgradation in smart contract is very important part, to enhance functionality or improve security. But updating a smart contract is different from tradition method. e.g. storage.sol a seperate storage contract to handle storage. and its library. Contract version 1: use the library of storage contract to access the storage contract. Backend contract version 2 Here…

  • Forced Ether Transfer

    via selfdestrcut method ether can be transferred without using payable key word. here is the example.

  • Registry Upgradeable Pattern

    Here is the first pattern to upgrade a smart contract via a middle registry contract. Which returns the new version contract. Below is the structure of Registry Upgradeable Smart Contract Pattern. Onwer.sol registry.sol this contract act as a middle man to get the address of upgraded of latest backend contract. BackendContract.sol this is the main…