Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immutable in Neo.VM #815

Open
shargon opened this issue Nov 15, 2023 · 3 comments
Open

Immutable in Neo.VM #815

shargon opened this issue Nov 15, 2023 · 3 comments

Comments

@shargon
Copy link
Member

shargon commented Nov 15, 2023

Following the line of #585 we should be able to have the same as immutable in solidity.

We can use readonly and the constructor of the class, if the contract have a constructor it could be called during _ondeploy, then, we can modify the script like evm does for immutables, it will be storage free and safe to read this values because these values will be converted as constants in the script.

Maybe we can create a new syscall that can be called only during _ondeploy for replace this constants, then the rest can be done in the compiler.

class contract : SmartContract
{
   public readonly Uint160 owner;

   public contract()
   {
     owner = Runtime.CallingScriptHash;
   }
}
@cschuchardt88
Copy link
Member

Is that like neo-project/proposals#159 owner? Or is it for tracking a contract address?

@shargon
Copy link
Member Author

shargon commented Nov 15, 2023

Is for gas saving, you can use whatever you want. Also it abstract the storage access (like #585) that is so different than in solidity, it will be easy to attract solidity developers.

@shargon
Copy link
Member Author

shargon commented Feb 26, 2024

I think that is not possible without a new syscall for tamper the script during _deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants