You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This is probably the simplest possible Tact program. It will provide callers with the classic output "hello world".</p>
64
64
<p>Tact lets you write smart contracts. This code defines a single contract named <code>HelloWorld</code>. Smart contracts must be deployed to the blockchain network to be usable, try to deploy this contract by pressing the <spanclass="mdButton blue">Deploy</span> button.</p>
65
-
<p>Contract deployments usually cost gas. This learning tool deploys to an <ahref="https://github.com/tact-lang/tact-emulator">emulator</a> of TON blockchain, so gas is emulated TON coin (which is free).</p>
65
+
<p>Contract deployments usually cost gas. This website deploys to an <ahref="https://github.com/tact-lang/tact-emulator">emulator</a> of TON blockchain, so gas is emulated TON coin (which is free).</p>
66
+
<p>If you're unfamilar with terms like <em>contract</em>, <em>deployment</em> and <em>gas</em>, please <ahref="https://blog.ton.org/what_is_blockchain">read this post</a> first. It's a great introduction to all blockchain terminology you will need to learn Tact.</p>
<p>Contracts can have <em>getters</em> like <code>greeting()</code>. Getters are special external interface functions that allow users to query information from the contract. Try to call the getter by pressing the <spanclass="mdButton teal">Get greeting</span> button. Calling getters is free and does not cost gas.</p>
68
-
<p>Getter declarations in Tact always start with the <code>get</code> prefix. The getter must also specify its return type - <code>String</code>in this case. If we were to omit the <code>get</code> from the function declaration, external users would no longer be able call this function and it would essentially become a private method.</p>
69
+
<p>Don't worry if some things aren't clear now, we will dive into getters in more detail later.</p>
<p>Tact doesn'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>
64
64
<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>
65
-
<p>This message has a single field, <code>queryId</code>, which is provided by the deployer. 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>
66
-
<p>If you're using TypeScript to deploy, sending the deploy message should look like:</p>
65
+
<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>
66
+
<p>If you're using Tact's <ahref="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>
<p>You can see the implementation of the trait <ahref="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>
0 commit comments