Immutable variables are like constants except value are assigned when the contract is deployed.
immutable
variables?msg.sender
immutable
?Like constants, immutable
variables save run time gas
# pragma version ^0.4.0
OWNER: public(immutable(address))
MY_IMMUTABLE: public(immutable(uint256))
@deploy
def __init__(val: uint256):
OWNER = msg.sender
MY_IMMUTABLE = val
@external
@view
def get_my_immutable() -> uint256:
return MY_IMMUTABLE
Try on Smart Contract Engineer