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
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/receive.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ To receive a message of the required type, you need to declare a receiver functi
15
15
There are several receiver functions. All receiver functions are processed in the order they are listed below:
16
16
17
17
*`receive(){:tact}` - called when an empty message is sent to the contract
18
-
*`receive("message"){:tact}` - called when a text message with a specific comment is sent to the contract
18
+
*`receive("message"){:tact}` - called when a text message with a specific comment is sent to the contract (maximum `"message"{:tact}` length is 123 bytes)
19
19
*`receive(str: String){:tact}` - called when an arbitrary text message is sent to the contract
20
20
*`receive(msg: MyMessage){:tact}` - called when a binary message of type `MyMessage` is sent to the contract
21
21
*`receive(msg: Slice){:tact}` - called when binary message of unknown type is sent to the contract
Strings are immutable sequences of characters, which means that once a [`String{:tact}`][p] is created, it cannot be changed. Strings are useful to store text, and so they can be converted to [`Cell{:tact}`][cell] type to be used as message bodies.
7
9
8
10
To be able to concatenate strings in a gas-efficient way, use a [`StringBuilder{:tact}`][p].
@@ -105,6 +107,8 @@ let fizz: StringBuilder = beginString()
105
107
106
108
## StringBuilder.toString
107
109
110
+
<Badgetext="Gas-expensive"title="Uses 500 gas units or more"variant="danger"size="medium"/><p/>
111
+
108
112
```tact
109
113
extends fun toString(self: StringBuilder): String;
110
114
```
@@ -122,6 +126,8 @@ let buzz: String = fizz.toString();
122
126
123
127
## StringBuilder.toCell
124
128
129
+
<Badgetext="Gas-expensive"title="Uses 500 gas units or more"variant="danger"size="medium"/><p/>
130
+
125
131
```tact
126
132
extends fun toCell(self: StringBuilder): Cell;
127
133
```
@@ -139,6 +145,8 @@ let buzz: Cell = fizz.toCell();
139
145
140
146
## StringBuilder.toSlice
141
147
148
+
<Badgetext="Gas-expensive"title="Uses 500 gas units or more"variant="danger"size="medium"/><p/>
149
+
142
150
```tact
143
151
extends fun toSlice(self: StringBuilder): Slice;
144
152
```
@@ -187,6 +195,8 @@ fizz == buzz; // true, but be careful as it's not always the case
187
195
188
196
## String.asComment
189
197
198
+
<Badgetext="Gas-expensive"title="Uses 500 gas units or more"variant="danger"size="medium"/><p/>
199
+
190
200
```tact
191
201
extends fun asComment(self: String): Cell;
192
202
```
@@ -277,6 +287,8 @@ let fizz: Slice = s.fromBase64();
277
287
278
288
## Int.toString
279
289
290
+
<Badgetext="Gas-expensive"title="Uses 500 gas units or more"variant="danger"size="medium"/><p/>
0 commit comments