8000 Explicit contract state saving mechanism · Issue #2496 · tact-lang/tact · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Explicit contract state saving mechanism #2496
Open
@anton-trunov

Description

@anton-trunov

The commit() function is usually used in conjunction with persisting the contract state, although not always. For example, Wallet v5 uses commit() conditionally after persisting the contract state.

Tact implicitly persists the contract state at the end of executing a receiver, but there is no native explicit mechanism in Tact to trigger early contract state saves.

Note: we need to deal with the lazy deployment flag in init is used.

Option 1: setData(self.toCell())

This could be done with either with

asm fun setData(data: Cell) { c4 POP }

setData(self.toCell());  // self refers to the contract here, although currently .toCell() methods are not supported for contracts

commit();

Can be named persistState() instead, up for discussion.

Option 2: persist statement

Or, this could be supported in the language with a persist statement:

persist;
commit();

Even commit() can be supported as a statement.

Also, there needs to be a combination of commit and persist, because one usually needs both following each other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: language featureIntent to add a language featurescope: stdlibThe Tact standard library (src/stdlib)

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0