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.
This is used to call other contract method but any change in states happened in the caller contract not in the targeted 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
There 2 Types of bytes: Fixed size bytes from (bytes1 to bytes32) dynamic bytes (with specific length)
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.
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… Continue reading Eternal Upgradeable Pattern in Solidity
via selfdestrcut method ether can be transferred without using payable key word. here is the example.
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… Continue reading Registry Upgradeable Pattern
Receive function is used to get ether on contract call. It must be external with payable visibility. it only call from other contract with call method and send, transfer throw an error.