Replies: 3 comments 1 reply
-
You raise an interesting question about the concept of smart contracts. While it is true that smart contracts are typically designed to be immutable and enforceable digital agreements, they can also include functionality for updating or modifying their state under certain conditions. In the case of Patrick's smart contract that stores a favorite number, it includes a function setFavoriteNumber(uint256 _favoriteNumber) which allows the user to update the stored value of their favorite number. This function includes a condition that restricts its use to only the owner of the smart contract, as defined in the constructor function constructor() public { owner = msg.sender; }. This helps ensure that the smart contract's state can only be modified by authorized parties. So while the stored value of the favorite number can be updated, the smart contract's overall functionality and behavior remains immutable and enforced according to its code. |
Beta Was this translation helpful? Give feedback.
-
Immutability does not mean that we stop updating the variables of smart contracts(For example you have 100 USDC tokens and you send 20 USDC tokens to any address, so how do smart contracts deduct 20 USDC from your balance and add to the recipient balance if they do not update the balances mappings?). But yes, it is very important for us to know who has the control of updating that if it centralized authority then we should think once before use. |
Beta Was this translation helpful? Give feedback.
-
@salsiq , |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In lesson 2 Patrick has written a smart contract, which stores a favroite number. I have doubts
How storing a number becomes a smart contract as smart were said to be digital agreements which are immutable or unbreakable
promises.
We can't change what is present in smart contract but how we are able to change the favrotie number values
Beta Was this translation helpful? Give feedback.
All reactions