One difference ik is that constant is never padded to 32 bytes , while immutable does. So what extraordinary thing this immutable is doing , can someone pls explain.
The constant is cheaper as well
Jul 21, 2023, 4:28 AM
Anyone knows this ?
Jul 21, 2023, 5:32 AM
immutable are gas efficient, as they are not stored directly in the storage
Jul 21, 2023, 6:23 AM
What about constant? Aren't they also not stored in storage?
Jul 21, 2023, 6:24 AM
Correct, not stored either
Jul 21, 2023, 6:25 AM
But ain't constant better since they are not padded in run time byte code.
So why was immutable introduced, when constant was doing it's job properly on being a constant
Jul 21, 2023, 7:09 AM
Because you can set immutable in the constructor, you can't do that with a constant
Jul 21, 2023, 7:10 AM
Is it introduced cause we needed to set a constant from outside while deploying contract as constructor parameter?
So why they didn't made this functionality on constant itself
So why they didn't made this functionality on constant itself
Jul 21, 2023, 7:10 AM
Constant was implemented before immutable, it was added from 0.6.5
Immutable was added
Jul 21, 2023, 7:20 AM
Imagine having a script deploying contract A and contract B, and in contract B, you need the address of contract A which will never change in the future. You don't know the address of contract A until you deploy it, but once its known, its never gonna change for contract B.
Immutable is da way
Immutable is da way
Jul 21, 2023, 12:09 PM
Thanks 👍
Forgot to say 👍 thanks to you too
I have been lurking in web3 space just observing. I have decided to go down the audit path. I am starting
Jul 22, 2023, 2:53 AM