Skip to content

Commit

Permalink
Merge pull request #23 from tact-lang/howard-patch-9-content
Browse files Browse the repository at this point in the history
Updates. [0.6.2] - 2023-10-30
  • Loading branch information
howardpen9 authored Oct 29, 2023
2 parents b5e61a2 + 6c9ca93 commit 770837d
Show file tree
Hide file tree
Showing 105 changed files with 1,437 additions and 1,498 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Original goal is followed [Tact Compiler Changelog](https://github.com/tact-lang/tact/tree/main), and keep this project in sync. Enjoy! ❤️❤️❤️

## [0.6.2] - 2023-10-30

- Add 2 PRs from [Breakfast](https://github.com/topics/hacktoberfest)
- https://github.com/tact-lang/tact-by-example/commit/19288b393e07cbf14fa6bffec995eebdad7b06be
- https://github.com/tact-lang/tact-by-example/commit/eb8b47123218b24b5ecf8938eafe9ab31c0482d2
- Modify and add the new content and fix the grammer errors

## [0.5.0] - 2023-10-05

### Added
Expand Down
14 changes: 7 additions & 7 deletions docs/00-hello-world.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
<meta http-equiv="content-security-policy" content="">
<link href="./_app/immutable/assets/_layout.e2caa7e1.css" rel="stylesheet">
<link href="./_app/immutable/assets/app.8bddbbc4.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.ec35243e.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.31b0bf06.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.9fe14626.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.0c49780f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.4a86d88e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.1c761ed5.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.d3cb7c1d.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.8558dfc5.js">
<link rel="modulepreload" href="./_app/immutable/entry/layout.svelte.2cd9eabd.js">
<link rel="modulepreload" href="./_app/immutable/entry/_layout.ts.984db11e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/_layout.da46b06b.js">
Expand Down Expand Up @@ -100,7 +100,7 @@

<script>
{
__sveltekit_16o0bmh = {
__sveltekit_wfqjrz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
Expand All @@ -109,10 +109,10 @@
const data = [null,null,null];

Promise.all([
import("./_app/immutable/entry/start.ec35243e.js"),
import("./_app/immutable/entry/app.d3cb7c1d.js")
import("./_app/immutable/entry/start.31b0bf06.js"),
import("./_app/immutable/entry/app.8558dfc5.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_16o0bmh.element, {
kit.start(app, __sveltekit_wfqjrz.element, {
node_ids: [0, 2, 5],
data,
form: null,
Expand Down
16 changes: 8 additions & 8 deletions docs/01-a-simple-counter.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<meta http-equiv="content-security-policy" content="">
<link href="./_app/immutable/assets/_layout.e2caa7e1.css" rel="stylesheet">
<link href="./_app/immutable/assets/app.8bddbbc4.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.ec35243e.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.31b0bf06.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.9fe14626.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.0c49780f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.4a86d88e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.1c761ed5.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.d3cb7c1d.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.8558dfc5.js">
<link rel="modulepreload" href="./_app/immutable/entry/layout.svelte.2cd9eabd.js">
<link rel="modulepreload" href="./_app/immutable/entry/_layout.ts.984db11e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/_layout.da46b06b.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-layout.svelte.4abe3603.js">
<link rel="modulepreload" href="./_app/immutable/chunks/store.476c3091.js">
<link rel="modulepreload" href="./_app/immutable/chunks/examples.ec427188.js">
<link rel="modulepreload" href="./_app/immutable/chunks/app.cf8f4105.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-01-a-simple-counter-page.svelte.e7d6c12d.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-01-a-simple-counter-page.svelte.d7d63907.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.c056099e.js">
</head>
<body>
Expand Down Expand Up @@ -128,7 +128,7 @@ <h2 id="a-simple-interaction">A simple interaction</h2>

<script>
{
__sveltekit_16o0bmh = {
__sveltekit_wfqjrz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
Expand All @@ -137,10 +137,10 @@ <h2 id="a-simple-interaction">A simple interaction</h2>
const data = [null,null,null];

Promise.all([
import("./_app/immutable/entry/start.ec35243e.js"),
import("./_app/immutable/entry/app.d3cb7c1d.js")
import("./_app/immutable/entry/start.31b0bf06.js"),
import("./_app/immutable/entry/app.8558dfc5.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_16o0bmh.element, {
kit.start(app, __sveltekit_wfqjrz.element, {
node_ids: [0, 2, 6],
data,
form: null,
Expand Down
23 changes: 14 additions & 9 deletions docs/01-the-deployable-trait.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<meta http-equiv="content-security-policy" content="">
<link href="./_app/immutable/assets/_layout.e2caa7e1.css" rel="stylesheet">
<link href="./_app/immutable/assets/app.8bddbbc4.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.ec35243e.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.31b0bf06.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.9fe14626.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.0c49780f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.4a86d88e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.1c761ed5.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.d3cb7c1d.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.8558dfc5.js">
<link rel="modulepreload" href="./_app/immutable/entry/layout.svelte.2cd9eabd.js">
<link rel="modulepreload" href="./_app/immutable/entry/_layout.ts.984db11e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/_layout.da46b06b.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-layout.svelte.4abe3603.js">
<link rel="modulepreload" href="./_app/immutable/chunks/store.476c3091.js">
<link rel="modulepreload" href="./_app/immutable/chunks/examples.ec427188.js">
<link rel="modulepreload" href="./_app/immutable/chunks/app.cf8f4105.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-01-the-deployable-trait-page.svelte.9e6b2cfe.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-01-the-deployable-trait-page.svelte.cab4baf4.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.c056099e.js">
</head>
<body>
Expand All @@ -64,8 +64,13 @@
<p>This contract has a state variable <code>val</code> that persists between contract calls - the counter value. When persisted, this variable is encoded <code>as uint32</code> - a 32-bit unsigned integer. Contracts pay rent in proportion to the amount of persistent space they consume, so compact representations are encouraged.</p>
<p>State variables should be initialized in <code>init()</code> that runs on deployment of the contract.</p>
<h2 id="receiving-messages">Receiving messages</h2>
<p>This contract can receive <em>messages</em> from users. Unlike getters that are just read-only, messages can do write operations and change the contract&#39;s persistent state. Incoming messages are processed in <code>receive()</code> methods as transactions and cost gas for the sender.</p>
<p>This contract can receive <strong><em>messages</em></strong> from users.</p>
<p>Unlike getters that are just read-only, messages can do write operations and change the contract&#39;s persistent state. Incoming messages are processed in <code>receive()</code> methods as transactions and cost gas for the sender.</p>
<p>After deploying the contract, send the <code>increment</code> message by pressing the <span class="mdButton grape">Send increment</span> button in order to increase the counter value by one. Afterwards, call the getter <code>value()</code> to see that the value indeed changed.</p>
<div style="padding-left: 1em; margin: 1em 0; position: relative;">
<div style="position: absolute; top: 0; bottom: 0%; left: 0; width: 3px; background-color: green;"></div>
<strong>Info</strong>: We will learn more in details about "getter" functions in the next example.
</div>
<!-- HTML_TAG_END -->
<div class="navMarkdown">
</div>
Expand Down Expand Up @@ -134,7 +139,7 @@ <h2 id="receiving-messages">Receiving messages</h2>

<script>
{
__sveltekit_16o0bmh = {
__sveltekit_wfqjrz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
Expand All @@ -143,10 +148,10 @@ <h2 id="receiving-messages">Receiving messages</h2>
const data = [null,null,null];

Promise.all([
import("./_app/immutable/entry/start.ec35243e.js"),
import("./_app/immutable/entry/app.d3cb7c1d.js")
import("./_app/immutable/entry/start.31b0bf06.js"),
import("./_app/immutable/entry/app.8558dfc5.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_16o0bmh.element, {
kit.start(app, __sveltekit_wfqjrz.element, {
node_ids: [0, 2, 7],
data,
form: null,
Expand Down
28 changes: 15 additions & 13 deletions docs/02-addresses.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<meta http-equiv="content-security-policy" content="">
<link href="./_app/immutable/assets/_layout.e2caa7e1.css" rel="stylesheet">
<link href="./_app/immutable/assets/app.8bddbbc4.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.ec35243e.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.31b0bf06.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.9fe14626.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.0c49780f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.4a86d88e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.1c761ed5.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.d3cb7c1d.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.8558dfc5.js">
<link rel="modulepreload" href="./_app/immutable/entry/layout.svelte.2cd9eabd.js">
<link rel="modulepreload" href="./_app/immutable/entry/_layout.ts.984db11e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/_layout.da46b06b.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-layout.svelte.4abe3603.js">
<link rel="modulepreload" href="./_app/immutable/chunks/store.476c3091.js">
<link rel="modulepreload" href="./_app/immutable/chunks/examples.ec427188.js">
<link rel="modulepreload" href="./_app/immutable/chunks/app.cf8f4105.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-02-addresses-page.svelte.5e6bfe1c.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-02-addresses-page.svelte.e721ceab.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.c056099e.js">
</head>
<body>
Expand All @@ -60,14 +60,16 @@


<div class="split vertical svelte-9dft0e" style="--primary-size:47%;--min-primary-size:0;--min-secondary-size:0;--splitter-size:7px"><div class="primary svelte-9dft0e"><div slot="primary" class="panelMarkdown" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: scroll;"><!-- HTML_TAG_START --><h1 id="the-deployable-trait">The Deployable Trait</h1>
<p>Tact doesn&#39;t support classical class inheritance, but contracts can implement <em>traits</em>. One of the commonly used traits is <code>Deployable</code>. It implements a simple receiver for the <code>Deploy</code> message which helps deploy contracts in a standard way.</p>
<p>All contracts are deployed by sending them a message. This can be any message, but best practice is to designate the special <code>Deploy</code> message for this purpose.</p>
<p>This message has a single field, <code>queryId</code>, which is provided by the deployer (normally zero). If the deploy succeeds, the contract will reply with the message <code>DeployOk</code> and echo the same <code>queryId</code> in the response.</p>
<p>Tact doesn&#39;t support classical class inheritance, but contracts can implement <strong><em>traits</em></strong>.</p>
<p>One commonly used trait is <code>Deployable</code>, which implements a simple receiver for the <code>Deploy</code> message. This helps deploy contracts in a standardized manner.</p>
<p>All contracts are deployed by sending them a message. While any message can be used for this purpose, best practice is to use the special <code>Deploy</code> message.</p>
<p>This message has a single field, <code>queryId</code>, provided by the deployer (usually set to zero). If the deployment succeeds, the contract will reply with a <code>DeployOk</code> message and echo the same <code>queryId</code> in the response.</p>
<hr>
<p>If you&#39;re using Tact&#39;s <a href="https://docs.tact-lang.org/tools/typescript#tact-contract-in-typescript">auto-generated</a> TypeScript classes to deploy, sending the deploy message should look like:</p>
<pre><code class="language-ts">const msg = { $$type: &quot;Deploy&quot;, queryId: 0n };
await contract.send(sender, { value: toNano(1) }, msg);
await contract.send(sender, { value: toNano(1) }, msg);
</code></pre>
<p>You can see the implementation of the trait <a href="https://github.com/tact-lang/tact/blob/main/stdlib/libs/deploy.tact">here</a>. Notice that the file <em>deploy.tact</em> needs to be imported from the standard library using the <code>import</code> keyword.</p>
<p>You can see the implementation of the trait <a href="https://github.com/tact-lang/tact/blob/main/stdlib/libs/deploy.tact">here</a>. Notice that the file <strong><em>deploy.tact</em></strong> needs to be imported from the standard library using the <code>import</code> keyword.</p>
<!-- HTML_TAG_END -->
<div class="navMarkdown">
</div>
Expand Down Expand Up @@ -162,7 +164,7 @@

<script>
{
__sveltekit_16o0bmh = {
__sveltekit_wfqjrz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
Expand All @@ -171,10 +173,10 @@
const data = [null,null,null];

Promise.all([
import("./_app/immutable/entry/start.ec35243e.js"),
import("./_app/immutable/entry/app.d3cb7c1d.js")
import("./_app/immutable/entry/start.31b0bf06.js"),
import("./_app/immutable/entry/app.8558dfc5.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_16o0bmh.element, {
kit.start(app, __sveltekit_wfqjrz.element, {
node_ids: [0, 2, 8],
data,
form: null,
Expand Down
18 changes: 9 additions & 9 deletions docs/02-bools.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<meta http-equiv="content-security-policy" content="">
<link href="./_app/immutable/assets/_layout.e2caa7e1.css" rel="stylesheet">
<link href="./_app/immutable/assets/app.8bddbbc4.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.ec35243e.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.31b0bf06.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.9fe14626.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.0c49780f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.4a86d88e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.1c761ed5.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.d3cb7c1d.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.8558dfc5.js">
<link rel="modulepreload" href="./_app/immutable/entry/layout.svelte.2cd9eabd.js">
<link rel="modulepreload" href="./_app/immutable/entry/_layout.ts.984db11e.js">
<link rel="modulepreload" href="./_app/immutable/chunks/_layout.da46b06b.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-layout.svelte.4abe3603.js">
<link rel="modulepreload" href="./_app/immutable/chunks/store.476c3091.js">
<link rel="modulepreload" href="./_app/immutable/chunks/examples.ec427188.js">
<link rel="modulepreload" href="./_app/immutable/chunks/app.cf8f4105.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-02-bools-page.svelte.d829d2e7.js">
<link rel="modulepreload" href="./_app/immutable/entry/(examples)-02-bools-page.svelte.06b72b09.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.c056099e.js">
</head>
<body>
Expand All @@ -70,7 +70,7 @@
</ul>
<p>There are multiple ways on TON to <a href="https://docs.ton.org/learn/overviews/addresses#bounceable-vs-non-bounceable-addresses">represent</a> the same address. Notice in the contract that the bouncable and non-bouncable representations of the same address actually generate the exact same value. Inside the contract, it doesn&#39;t matter which representation you use.</p>
<h2 id="state-costs">State costs</h2>
<p>Most addresses take 264-bit to store (8-bit for the workchain id and 256-bit for the account id). This means that storing 1000 addresses <a href="https://ton.org/docs/develop/smart-contracts/fees#how-to-calculate-fees">costs</a> about 0.189 TON per year.</p>
<p>Most addresses take 264-bit to store (8-bit for the workchain id and 256-bit for the account id). <strong>This means that storing 1000 addresses <a href="https://ton.org/docs/develop/smart-contracts/fees#how-to-calculate-fees">costs</a> about 0.189 TON per year.</strong></p>
<!-- HTML_TAG_END -->
<div class="navMarkdown">
</div>
Expand Down Expand Up @@ -161,7 +161,7 @@ <h2 id="state-costs">State costs</h2>

<script>
{
__sveltekit_16o0bmh = {
__sveltekit_wfqjrz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
Expand All @@ -170,10 +170,10 @@ <h2 id="state-costs">State costs</h2>
const data = [null,null,null];

Promise.all([
import("./_app/immutable/entry/start.ec35243e.js"),
import("./_app/immutable/entry/app.d3cb7c1d.js")
import("./_app/immutable/entry/start.31b0bf06.js"),
import("./_app/immutable/entry/app.8558dfc5.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_16o0bmh.element, {
kit.start(app, __sveltekit_wfqjrz.element, {
node_ids: [0, 2, 9],
data,
form: null,
Expand Down
Loading

0 comments on commit 770837d

Please sign in to comment.