Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Refine grammar and style in the documentation's language section. (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Trunov <[email protected]>
  • Loading branch information
DanIsNearby and anton-trunov authored Jan 28, 2024
1 parent 41012cd commit 8ce47ce
Show file tree
Hide file tree
Showing 17 changed files with 125 additions and 125 deletions.
6 changes: 3 additions & 3 deletions pages/language/guides/bounced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Callout } from 'nextra-theme-docs'

# Bounced messages

When contract sends a message with a flag bounce set to true, than if the message wasn't processed properly, it would bounce back to the sender. This is useful when you want to make sure that the message was processed properly and if not - revert the changes.
When a contract sends a message with a flag bounce set to true, then if the message wasn't processed properly, it would bounce back to the sender. This is useful when you want to make sure that the message was processed properly and if not - revert the changes.

## Caveats

Currently in TON bounced messages have only 224 usable data bits in the message and no references. This means that you can't recover much of a data from the bounced message. This is a limitation of the TON blockchain and will be fixed in the future. Tact helps you to check if your message fits the limit and if not - it will suggest to use a special type modifier `bounced<T>` for receiver that would construct a partial representation that fits into required limits.
Currently in TON bounced messages have only 224 usable data bits in the message and no references. This means that you can't recover much of the data from the bounced message. This is a limitation of the TON blockchain and will be fixed in the future. Tact helps you to check if your message fits the limit and if not - it will suggest to use a special type modifier `bounced<T>` for the receiver that would construct a partial representation that fits into the required limits.

## Bounced messages in Tact

Expand All @@ -24,7 +24,7 @@ contract MyContract {
}
```

To process bounced message manually, you can use a fallback definition that handles raw `Slice` instead of a message:
To process bounced messages manually, you can use a fallback definition that handles raw `Slice` instead of a message:

```tact
contract MyContract {
Expand Down
64 changes: 32 additions & 32 deletions pages/language/guides/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- bitwise and and or operations
- bitwise 'and' and 'or' operations
- statically compile expressions with bitwise operations if possible

## [1.1.2] - 2023-04-28
Expand All @@ -29,9 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### ⚡️ Breaking changes

- `reply` is now a method of `Contract` instead of global context and changed it's behaviour if storage reserve is non-zero in contract.
- Logical expressions are now calculated differently: `&&` now does not execute right expression if left is `false` and `||` does not execute right expression if left is `true`. Before it was executed in any case. This change is made in attempt to reduce unexpected behaviour.
- `OwnableTransferable` is now sends response to the sender.
- `reply` is now a method of `Contract` instead of global context and changed its behavior if the storage reserve is non-zero in the contract.
- Logical expressions are now calculated differently: `&&` now does not execute the right expression if the left is `false` and `||` does not execute the right expression if the left is `true`. Before it was executed in any case. This change is made in an attempt to reduce unexpected behavior.
- `OwnableTransferable` now sends a response to the sender.
- `overwrites` was renamed to `override`
- `Deployable` trait now sends non-bounceable notifications instead of bounceable ones.

Expand All @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Address` to `Address` maps
- Ability to define key and value serializations for maps
- `sha256` hashing
- `forward` and `notify` functions that can be used to send messages to other contracts using remaining value of incoming message
- `forward` and `notify` functions that can be used to send messages to other contracts using the remaining value of the incoming message
- `virtual` and `abstract` constants that can be shared between traits
- `storageReserve` constant in every contract that can be used to reserve some storage space by any trait
- `abstract` functions that can be implemented in contracts
Expand All @@ -62,30 +62,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- `sender()` function to get message sender address
- `sender()` function to get the message sender address
- `pow` function for exponentiation
- `address()` compile-time function for creating addresses from strings
- `cell()` compile-time function for creating cells from base64 strings
- `interfaces` field to ABI
- report workchain support in interfaces
- exported `check` function for language server support
- `logger` interface to programmatic API
- `verify` function to verify compiled package
- `verify` function to verify the compiled package

### Changed

- Upgrade `func` to `0.4.2`
- Contracts now work only with basic workchain. To enable masterchain support set `masterchain: true` in `tact.conf.json`
- Contracts now can be deployed only to the basic workchain unless `masterchain` set `true`
- Checking field initialization in init function
- Checking field initialization in the init function

### Fixed

- Windows paths support

### Removed

- Removed jetton library from stdlib. It would be re-introduced after 1.0 version with more thought put into it.
- Removed Jetton library from stdlib. It would be re-introduced after the 1.0 version with more thought put into it.

## [0.10.1] - 2023-02-23

Expand All @@ -102,19 +102,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Tact contracts are now [Argument-addressable](https://docs.tact-lang.org/evolution/OTP-005) meaning that they depend on init arguments and code hash only. Init function is now called when first valid message is received.
- Tact contracts are now [Argument-addressable](https://docs.tact-lang.org/evolution/OTP-005) meaning that they depend on init arguments and code hash only. The init function is now called when the first valid message is received.
- Refactoring of allocator
- Moving contract's load function to the beginning of the execution
- Moving contract's save function to the end of the execution
- moving `debug` flag from `experimental` to `parameters` in `tact.config.json`
- Unknown fields in config are now considered an error
- Moving the contract's load function to the beginning of the execution
- Moving the contract's save function to the end of the execution
- moving the `debug` flag from `experimental` to `parameters` in `tact.config.json`
- Unknown fields in the config are now considered an error
- Allow contracts without fields
- Typescript bindings are now working in browser and doesn't have `ton-emulator` dependency
- Typescript bindings are now working in the browser and don't have `ton-emulator` dependency
- `map` syntax now uses `<>` instead of `[]` for future compatibility with generics

### Added

- Allow `Builder` type as a field type similar to `Cell` and `Slice`
- Allow the `Builder` type as a field type similar to `Cell` and `Slice`
- Allow `String` type as a field type

## [0.9.3] - 2023-02-19
Expand All @@ -133,13 +133,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- `emptyMap()` for creating empty maps
- Allowing assigning `null` value to a map variable (same as calling `emptyMap()`)
- Allowing assigning the `null` value to a map variable (same as calling `emptyMap()`)

## [0.9.1] - 2023-02-03

### Changed

- Update `dump` function to handle booleans and strings, better type checking or arguments
- Update the `dump` function to handle booleans and strings, better type checking or arguments
- Report `org.ton.debug.v0` interface if debug mode is enabled
- Update bindings generator to support `ton-emulator >= v2.1.0`

Expand Down Expand Up @@ -241,12 +241,12 @@ Fixing missing NPM release

### Changed

- Changed message id algorithm to the one based on type signatures instead of tlb
- Changed message ID algorithm to the one based on type signatures instead of TLB

### Added

- Dictionaries in typescript bindings
- Introduced packaging compilation step that packages a contract to a single package that can be deployed in predictable way.
- Introduced a packaging compilation step that packages a contract to a single package that can be deployed predictably.
- `tact-bindings` to build bindings to non-tact contracts

## [0.7.1] - 2023-01-04
Expand All @@ -269,8 +269,8 @@ Fixing missing NPM release

### Changed

- Updated codegen to prefix function names with a `$` to avoid clashing with system functions
- `random` and `randomInt` that are correctly initialized on first use unlike native one
- Updated code generation to prefix function names with a `$` to avoid clashing with system functions
- `random` and `randomInt` that are correctly initialized on first use unlike the native one
- Changed the way get and init methods expect their arguments and return values to match func-like primitives

### Fixed
Expand Down Expand Up @@ -299,7 +299,7 @@ Fixing missing NPM release

### Changed

- `require` now accepts two arguments, second one must be a string literal that has error message. This error message then will be exported to ABI
- `require` now accepts two arguments: the second one must be a string literal that has an error message. This error message then will be exported to ABI
- Optional `Address` fields are not encoded using native representation

## [0.4.0] - 2022-12-22
Expand All @@ -319,23 +319,23 @@ Fixing missing NPM release
- `String` literals and variables
- `Int.toString()` and `Int.toFloatString()`
- `StringBuilder` for gas-efficient string building
- Global compile-time `ton` function that converts string to Int during compile time.
- Global compile-time `ton` function that converts a string to `Int` during compile time.
- `checkDataSignature` similar to func `check_data_signature`
- `String.asComment` for conversion text to a comment payload
- `Resumable` trait, allows to resume contract operations once it was stopped
- `Resumable` trait, allows to resume operations, once the contract was stopped
- Comment receiver that allows to receive arbitrary comment
- `String.asSlice` cast string to a slice for parsing
- Binary shift operators `>>` and `<<`
- `Slice.fromBase64` that converts text slice that has base64 to binary representation (both classic and url)
- `Slice.fromBase64` that converts text slice that has base64 to binary representation (both classic and URL)
- `Slice.asCell`, `Builder.asCell`, `Cell.asSlice`, `Builder.asCell` convenience functions
- `Slice.loadCoins` that reads coins from slice
- `myBalance` that returns current balance of a contract before execution phase
- `Slice.loadCoins` that reads coins from a slice
- `myBalance` that returns the current balance of a contract before the execution phase

### Changed

- `contractAddress` now accepts single argument of type `StateInit` and always produces address for workchain. Old method is renamed to `contractAddressExt`.
- `hashCell` and `hashSlice` are now extension function `hash` on `Slice` and `Cell`
- Removed some keywords such as `message`, `contract`, `init` to allow use this names as variable names
- `contractAddress` now accepts a single argument of type `StateInit` and always produces an address for the workchain. The old method is renamed to `contractAddressExt`.
- `hashCell` and `hashSlice` are now extension functions `hash` on `Slice` and `Cell`
- Removed some keywords such as `message`, `contract`, `init` to allow the use of these names as variable names
- Renamed `receiveBounced` to `bounced`

### Fixed
Expand All @@ -352,4 +352,4 @@ Fixing missing NPM release
### Added

- `supported_interfaces` TEP support. TACT now automatically builds a list of supported interfaces of a contract
- `IPFS`-based ABI reporting. TACT now automatically calculates and embeds ABI hash into smart contract and prepares a file to upload to IPFS.
- `IPFS`-based ABI reporting. TACT now automatically calculates and embeds ABI hash into smart contracts and prepares a file to upload to IPFS.
6 changes: 3 additions & 3 deletions pages/language/guides/config.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

`tact.config.json` is an entry point to a Tact projects. It is a JSON file that contains the list of all projects and compiler parameters.
`tact.config.json` is an entry point to Tact projects. It is a JSON file that contains the list of all projects and compiler parameters.

## Project description

Expand All @@ -14,7 +14,7 @@ Each project is described by the following fields:
## Parameters

Tact support next parameters:
* `debug: true`. Enables debug output of a contracts. It is useful for debugging purposes. Enabling this contract would report that it was compiled in debug mode using `supported_interfaces` method.
* `debug: true`. Enables debug output of a contract. It is useful for debugging purposes. Enabling this contract would report that it was compiled in debug mode using the `supported_interfaces` method.
* `masterchain: true`. Enables [masterchain support](/language/guides/masterchain) in the contract.

## Example
Expand All @@ -41,4 +41,4 @@ Tact support next parameters:

Tact support next experimental parameters:

* `inline: true`. Enables inlining of all functions in contracts. Could reduce gas usage at the cost of bigger contract.
* `inline: true`. Enables inlining of all functions in contracts. Could reduce gas usage at the cost of a bigger contract.
10 changes: 5 additions & 5 deletions pages/language/guides/constants.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Constants

Constants in Tact could be a little bit more advanced than in popular languages: they could be virtual and abstract one. Smart contracts often need to implement multiple traits and sometimes you need to configure some of them in compile time. Constructors in traits are prohibited due their unpredicted behavior. So, we have to use constants and fields instead to pass values to them. it is job of a main contract to implement values and constants for all traits.
Constants in Tact could be a little bit more advanced than in popular languages: they could be virtual and abstract. Smart contracts often need to implement multiple traits and sometimes you need to configure some of them in compile time. Constructors in traits are prohibited due to their unpredicted behavior. So, we have to use constants and fields instead to pass values to them. It is the job of a main contract to implement values and constants for all traits.

## Simple constant

Let's start with a simple constant. It is a value that is defined in compile time and cannot be changed. You can define a constant on top level or inside a constract/trait. Let's define a constant on top level:
Let's start with a simple constant. It is a value that is defined in compile time and cannot be changed. You can define a constant on the top level or inside a contract/trait. Let's define a constant on top level:

```tact
const MY_CONSTANT: Int = 42;
```

Similar for trait and contracts:
Similar for traits and contracts:

```tact
trait MyTrait {
Expand All @@ -24,7 +24,7 @@ contract MyContract {

## Virtual and abstract constants

Virtual constants is the constants that could be defined in trait, but changed in contract. It is useful when you need to configure some of the traits in compile time. Let's define a virtual constant and an abstract one:
Virtual constants are the constants that could be defined in a trait but changed in a contract. It is useful when you need to configure some of the traits in compile time. Let's define a virtual constant and an abstract one:

```tact
trait MyTrait {
Expand All @@ -36,7 +36,7 @@ trait MyAbstractTrait {
}
```

Now you can overwrite defaults in contract:
Now you can overwrite defaults in the contract:

```tact
contract MyContract with MyTrait, MyAbstractTrait {
Expand Down
16 changes: 8 additions & 8 deletions pages/language/guides/debug.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Debugging Tact Contracts

Tact has a first-class support for Jest and `@tact-lang/emulator` for contract tests and debugging. Preferred type of tests are the one with inline snapshots. They are easy to write and easy to debug.
Tact has first-class support for Jest and `@tact-lang/emulator` for contract tests and debugging. The preferred type of test is the one with inline snapshots. They are easy to write and easy to debug.

For quick start, it is better to use `tact-template` that has everything built in.
For a quick start, it is better to use `tact-template` that has everything built in.

## Printing out debug data

Tact has a built-in `dump` function that is similar to the one in FunC that allows you to print out data in your contract. It is very useful for debugging.

To make `dump` work you need to enable feature `debug` in `tact.conf.json`.
To make `dump` work you need to enable the feature `debug` in `tact.conf.json`.

Example:
```tact
Expand All @@ -19,7 +19,7 @@ dump(a != null);

## Using `@tact-lang/emulator`

Ton Emulator allows you to have a small virtual blockchain in your nodejs code. This library is built specifically for testing smart contracts in unit tests.
Ton Emulator allows you to have a small virtual blockchain in your Node.js code. This library is built specifically for testing smart contracts in unit tests.

```typescript
import { ContractSystem } from '@tact-lang/emulator';
Expand Down Expand Up @@ -52,11 +52,11 @@ let logger = system.log(contract.address);
// Sending a message
//

// First we enqueue a messages. NOTE: You can enqueue multiple messages in row
// First we enqueue messages. NOTE: You can enqueue multiple messages in a row
await contract.send(treasure, { value: toNano(1) }, { $$type: "Deploy", queryId: 0n });
await contract.send(treasure, { value: toNano(1) }, { $$type: "Increment" });

// Run system until there are no more messages
// Run the system until there are no more messages
await system.run();

//
Expand Down Expand Up @@ -108,7 +108,7 @@ describe("contract", () => {

### Generating snapshots

After running `yarn jest` command, the line with `toMatchInlineSnapshot` of the test will be automatically updated with a snapshot of the output.
After running the `yarn jest` command, the line with `toMatchInlineSnapshot` of the test will be automatically updated with a snapshot of the output.

```typescript
// ...
Expand Down Expand Up @@ -163,4 +163,4 @@ After running `yarn jest` command, the line with `toMatchInlineSnapshot` of the

### Updating snapshots

When you change your contract, your snapshots will be outdated. For example, gas usage or addresses was changed. To update them, you need to run `yarn jest -u` command.
When you change your contract, your snapshots will be outdated. For example, gas usage or addresses were changed. To update them, you need to run the `yarn jest -u` command.
Loading

0 comments on commit 8ce47ce

Please sign in to comment.