OCamlPro / freeton_wallet

The 'ft' tool is a multi-account terminal wallet for the Free TON blockchain. It is based on the freeton_ocaml_sdk.
https://ocamlpro.github.io/freeton_wallet
Other
14 stars 9 forks source link

Feature request: add support for tvm_linker init in ft contrat --build or ft contract --deploy #38

Open ddeclerck opened 3 years ago

ddeclerck commented 3 years ago

When deploying a smart contract via code, one can specify the initial values of static variables by using the varInit argument of tvm.buildStateInit or new ([https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuildstateinit]).

When deploying a smart contract via command line, one can use tvm_linker init to specify the initial values of static variables, i.e.: tvm_linker init my_contract.tvm '{ "var1" : "value1", ... }' my_contract.abi.json

Being able to specify the initial values of static variables with ft contrat --build or ft contract --deploy (whichever is the most suitable) would be a valuable addition to ft.

lefessan commented 3 years ago

I don't like the idea of modifying the TVC image for such a purpose. It means that there will be one different TVC image for every such contract, and so, probably, we have to call it with a different contract name.

It would probably better to manage that at the account level, adding a field 'initial_data' in the account information. This information would be used to compute the address and when the contract is deployed.

Not easy to do, but feasible...

lefessan commented 3 years ago

The code is there: #40 but I am too lazy to test it during the week-end...

ddeclerck commented 3 years ago

Quite a big patch indeed. I'll test that tomorrow.

P.S: shouldn't you rest during week-ends ? ;)