Tact Cookbook
Tact Cookbook is to provide a centralized repository of valuable information and experience from experienced Tact developers for future developers.
This article is more focused on every day tasks Tact developer resolve during the development of smart contracts.
⚠ This is a concept article. We're still looking for someone experienced to write it. Read more about contributing on Tact Cookbook ton-footstep (opens in a new tab).
Basics
How to write exception statements
To declare exceptions in Tact suggested to use special function reqiure(condition, error message)
// throw "Empty counter" message when condition is equal True
require(ok1 && ok2 && ok3, "Invalid signature");
require(ctx.value >= ton("1"), "Invalid value");
⚠ Highly recommended to avoid native Func functions like
nativeThrow()
.
Receivers
How to declare a unified Tact receiver for comments
TODO
// throw "Empty counter" message when condition is equal True
receive()