|
1 |
| -# Deploy |
| 1 | +# Deployment of Tact contracts |
| 2 | + |
| 3 | +import { Callout } from 'nextra-theme-docs' |
| 4 | + |
| 5 | +In Tact, it's a common practice to make contracts inherit the [`Deployable{:tact}`][deployable] trait and deploy them via a sending special [`Deploy{:tact}`][deploy] message alongside the [initial state](/book/expressions#initof). |
| 6 | + |
| 7 | +Note, that contracts inheriting such trait return excessive funds upon deployment. That is, if you try to deploy a contract with any sufficient amount of Toncoins, the most of it (excluding fees) will be immediately returned to you after the deployment. |
| 8 | + |
| 9 | +<Callout> |
| 10 | + |
| 11 | + As a result, those contracts would have an empty Toncoin balance after the deployment. It's a good practice to introduce an empty `"topup"{:tact}` [receiver](/book/contracts#receiver-functions) function that can be used to top up the contract's balance at any given moment: |
| 12 | + |
| 13 | + ```tact |
| 14 | + receive("topup") {} |
| 15 | + ``` |
| 16 | + |
| 17 | +</Callout> |
| 18 | + |
| 19 | +## Deploying with `@ton/blueprint` [#blueprint] |
| 20 | + |
| 21 | +<Callout> |
| 22 | + |
| 23 | + To be written as per [#290](https://github.com/tact-lang/tact-docs/issues/290). |
| 24 | + |
| 25 | +</Callout> |
| 26 | + |
| 27 | +## Deploying with `@tact-lang/deployer` [#deployer] |
| 28 | + |
| 29 | +{/* To be enhanced in: https://github.com/tact-lang/tact-docs/issues/290 */} |
2 | 30 |
|
3 | 31 | Tact Deployer is a small library that integrates with [TON Verifier](https://verifier.ton.org) that allows you to deploy your contracts safely using your favorite wallet without needing to manage keys or deploy contracts manually. Tact Deployer also automatically verifies your contract's source code and you can be sure that your compiler is not compromised.
|
4 | 32 |
|
5 |
| -## Requirements |
| 33 | +### Requirements [#deployer-requirements] |
6 | 34 |
|
7 | 35 | Your contract MUST have the `Deployer` trait from the `@stdlib/deploy` package to be able to use Tact Deployer.
|
8 | 36 |
|
9 |
| -## Installation |
| 37 | +### Installation [#deployer-installation] |
10 | 38 |
|
11 | 39 | To add Tact Deployer to your project, just use `yarn`:
|
12 | 40 |
|
13 | 41 | ```bash
|
14 | 42 | yarn add @tact-lang/deployer
|
15 | 43 | ```
|
16 | 44 |
|
17 |
| -## How to use |
| 45 | +### Usage [#deployer-usage] |
18 | 46 |
|
19 | 47 | When you build your smart contracts using Tact, it produces a package (*.pkg) file that has all the required information about the built smart contract. To deploy your smart contract, you need to create a deployer instance, pass your package file to it and provide initial data for your contract.
|
20 | 48 |
|
@@ -47,4 +75,7 @@ console.log('Address: ' + address.toString({ testOnly: testnet }));
|
47 | 75 | console.log('Deploy link: ' + link);
|
48 | 76 | ```
|
49 | 77 |
|
50 |
| -After following this link you will be able to deploy and verify your smart contract. |
| 78 | +After following this link you will be able to deploy and verify your smart contract. |
| 79 | + |
| 80 | +[deployable]: /ref/stdlib-deploy#deployable |
| 81 | +[deploy]: /ref/stdlib-deploy#deploy |
0 commit comments