---
title: OTP-006：合约包
description: 该提案定义了一种将编译合约、其依赖关系和所有相关元数据打包成一个文件的方法
sidebar:
  order: 6
---

该提案定义了一种将编译合约、其依赖关系和所有相关元数据打包成一个文件的方法。

## 动机

需要一种统一的包格式，以简化使用各种工具部署和升级合约的过程，而无需进行配置。

## 技术说明

软件包文件的扩展名为".pkg"，是一个 JSON 文件：

```json
{
  "name": "My Contract",
  "code": "... boc of code ...",
  "abi": "ABI string to be uploaded as is to IPFS or Ton Storage",
  "init": {
    "kind": "direct", // Means that this contract can be deployed as is
    "args": {
      // ... Arguments in ABI format
    },
    "prefix": {
      // Optional prefix for contract init state
      "bits": 0, // Number of bits in prefix
      "value": 0 // Value of prefix
    },
    "deployment": {
      "kind": "system-cell", // Means that this contract can be deployed as is
      "system": "... boc of system cell ..."
    }
  },
  "sources": {
    "file.ton": "... base64 encoded source file ..."
  },
  "compiler": {
    "name": "func",
    "version": "0.4.1",
    "parameters": "..." // Optional string parameters
  }
}
```

## 缺点

无

## 参考资料

- Bags of Cells (BoC): https://docs.ton.org/develop/data-formats/cell-boc#packing-a-bag-of-cells
