Skip to main content
Version: 1.6.0

entry

The decorator @entry on a function marks said function as an entrypoint of the contract, either at top-level or in a namespace that is then used as a contract.

type storage = int;
type @return = [list<operation>, storage];
namespace Foo {
@entry
const decrement = (param: int, storage: storage) : @return =>
[[], storage - param];
@entry
const increment = (param: int, storage: storage) : @return =>
[[], storage + param];
@entry
const reset = (_u: unit, _s: storage) : @return =>
[[], 0];
@view
const get_storage = (_: unit, storage: storage) : storage => storage;
};

Note that if you want to define an entrypoint called default, use the escaped identifier @default because default is a keyword.