-
Comment In Solidity
Remembering code can be a challenging task, especially when returning to it after a long period of time. It becomes difficult to comprehend the purpose and functionality of the code. This is where comments play a crucial role in aiding our understanding of the code. Comments serve as helpful reminders or explanations about the logic…
-
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.
-
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…