Skip to content

OTP-006: Contract Package

This proposal defines a way to package compiled contract, its dependencies, and all related metadata into a single file.

Motivation

A unified package format is needed to simplify the process of deploying and upgrading contracts using various tools without the need to configure them.

Specification

The contract package is defined as a JSON file, usually with a .pkg extension:

{
"name": "ContractName",
"code": "...base64-encoded BoC...",
"abi": "...an ABI as a string to be uploaded as is to IPFS or Ton Storage...",
"init": {
"kind": "direct", // contract can be deployed as is
"args": [], // arguments in ABI-like format
"prefix": { // optional prefix for init()
"bits": 1, // number of bits
"value": 0 // value of the prefix
},
"deployment": {
"kind": "system-cell",
"system": null // removed in Tact 1.6.0
}
},
"sources": {
"contracts/stdlib.fc": "...base64-encoded source file...",
"contracts/contract_name.tact": "...base64-encoded source file..."
},
"compiler": {
"name": "tact",
"version": "1.5.3",
"parameters": "{...}" // a JSON as a string with an entrypoint and compilation options
}
}

The schema of the specification is typed and accessible via:

import type { PackageFileFormat } from '@tact-lang/compiler';

Drawbacks

None

Reference