You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contract Parent{
id: Int = 0;
init(){}
receive("new"){
self.id += 1;
let data = initOf Child(self.id);
self.forward(contractAddress(data), "init".asComment(), true, data);
}
}
contract Child{
id: Int;
init(id: Int){
self.id = id;
}
receive("init"){}
receive("deploy_random"){
let data = initOf Child(randomInt());
self.forward(contractAddress(data), "init".asComment(), true, data);
}
}
Under the hood, both Parent and Child contracts stores the code of Child smart contract in the system dictionary, because in both of them initOf Child() used.
But storing code of Child smart contract inside Child is useless because one can call MYCODEasm instruction to get it.
This approach would reduce not only storageFees, but also forwardFees when initializing new smart-contracts.
It is really useful feature for developing Jetton smart contracts (when one child deploys another child), which optimizes fees a lot.
Feel free to argue to my point.
The text was updated successfully, but these errors were encountered:
anton-trunov
changed the title
[Feature request] Do not store self smart-contract code: use MYCODE asm instruction instead
Do not store self smart-contract code: use MYCODE asm instruction instead
Nov 18, 2024
The problem
Lets take a look on a 2 simple smart-contracts:
Under the hood, both Parent and Child contracts stores the code of
Child
smart contract in the system dictionary, because in both of theminitOf Child()
used.But storing code of
Child
smart contract insideChild
is useless because one can callMYCODE
asm instruction to get it.This approach would reduce not only storageFees, but also forwardFees when initializing new smart-contracts.
It is really useful feature for developing
Jetton
smart contracts (when one child deploys another child), which optimizes fees a lot.Feel free to argue to my point.
The text was updated successfully, but these errors were encountered: