Skip to content

Commit 4b2ac3e

Browse files
committed
Content improvements due to qpwe feedback
1 parent cb044fa commit 4b2ac3e

File tree

8 files changed

+20
-9
lines changed

8 files changed

+20
-9
lines changed

src/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ input::-webkit-inner-spin-button {
156156

157157
.allLinks {
158158
padding: 80px;
159+
padding-bottom: 30px;
159160
text-align: center;
160161
}
161162

src/routes/(examples)/01-a-simple-counter/clean.tact

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ contract Counter {
1313
self.val = self.val + 1;
1414
}
1515

16-
// read only getter for querying the counter value
16+
// read-only getter for querying the counter value
1717
get fun value(): Int {
1818
return self.val;
1919
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# A Simple Counter
22

3-
This contract has a state variable that persists between contract calls, the counter value. When persisted, it's encoded as a `uint32` - a 32-bit unsigned integer. Contracts pay rent in proportion to the amount of persistent space they consume, so compact representations are encouraged.
3+
This is a simple counter contract that allows users to increment its value.
4+
5+
This contract has a state variable `val` that persists between contract calls - the counter value. When persisted, this variable is encoded `as uint32` - a 32-bit unsigned integer. Contracts pay rent in proportion to the amount of persistent space they consume, so compact representations are encouraged.
46

57
State variables should be initialized in `init()` that runs on deployment of the contract.
68

79
## Receiving messages
810

9-
This contract can receive messages. Unlike getters that are read-only and are free to call, messages can do write operations and change the persistent state. Incoming messages are processed in `receive()` methods as transactions and cost gas for the sender.
11+
This contract can receive *messages* from users. Unlike getters that are just read-only, messages can do write operations and change the contract's persistent state. Incoming messages are processed in `receive()` methods as transactions and cost gas for the sender.
1012

11-
After deploying the contract, send the `increment` message by pressing the <span class="mdButton grape">Send increment</span> button and then call the getter to see that the value indeed changed.
13+
After deploying the contract, send the `increment` 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 `value()` to see that the value indeed changed.

src/routes/(examples)/01-a-simple-counter/contract.tact

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract Counter {
1515
self.val = self.val + 1;
1616
}
1717

18-
// read only getter for querying the counter value
18+
// read-only getter for querying the counter value
1919
get fun value(): Int {
2020
return self.val;
2121
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
contract HelloWorld {
22

33
get fun greeting(): String {
4-
return "Hello World";
4+
return "hello world";
55
}
66

77
}

src/routes/(examples)/01-hello-world/content.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
This is probably the simplest possible Tact program. It will provide callers with the classic output "hello world".
44

5-
Tact lets you write smart contracts. This code defines a single contract named `HelloWorld`. Smart contracts must be deployed on-chain to be usable, try to deploy this contract by pressing the <span class="mdButton blue">Deploy</span> button.
5+
Tact lets you write smart contracts. This code defines a single contract named `HelloWorld`. Smart contracts must be deployed to the blockchain network to be usable, try to deploy this contract by pressing the <span class="mdButton blue">Deploy</span> button.
6+
7+
Contract deployments usually cost gas. This learning tool deploys to an [emulator](https://github.com/tact-lang/tact-emulator) of TON blockchain, so gas is emulated TON coin (which is free).
68

79
## A simple interaction
810

9-
Contracts can have _getters_ like `greeting()`. These are special functions that allow users to query information from the contract. Try to call the getter by pressing the <span class="mdButton teal">Get greeting</span> button.
11+
Contracts can have *getters* like `greeting()`. Getters are special external interface functions that allow users to query information from the contract. Try to call the getter by pressing the <span class="mdButton teal">Get greeting</span> button. Calling getters is free and does not cost gas.
12+
13+
Getter declarations in Tact always start with the `get` prefix. The getter must also specify its return type - `String` in this case. If we were to omit the `get` from the function declaration, external users would no longer be able call this function and it would essentially become a private method.

src/routes/(examples)/01-hello-world/contract.tact

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ contract HelloWorld {
55
receive() {}
66

77
get fun greeting(): String {
8-
return "Hello World";
8+
return "hello world";
99
}
1010
}

src/routes/all/[email protected]

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@
1212
<slot />
1313
</div>
1414
{/if}
15+
16+
<div class="panelMarkdown allExamples">
17+
Tact-by-Example is open-source on <a href="https://github.com/tact-lang/tact-by-example">GitHub</a> and created by <a href="https://t.me/talkol">@talkol</a>
18+
</div>

0 commit comments

Comments
 (0)