1.4 一个Forc项目 (A Forc Project)
To initialize a new project with Forc, use forc new:
要使用 Forc 初始化新项目,请使用forc new:
forc new my-fuel-project
Here is the project that Forc has initialized: 这是 Forc 初始化的项目(目录):
$ cd my-fuel-project
$ tree .
├── Forc.toml
└── src
└── main.sw
Forc.toml is the manifest file (similar to Cargo.toml for Cargo or package.json for Node), and defines project metadata such as the project name and dependencies.
Forc.toml 是 manifest 文件(类似于 Cargo 的Cargo.toml 或 Node 的package.json),并定义项目的元数据,例如项目名称和依赖。
For additional information on dependency management, see: here. 有关依赖管理的其他信息,请参阅:此处。
[project]
authors = ["User"]
entry = "main.sw"
license = "Apache-2.0"
name = "my-fuel-project"
[dependencies]
Here are the contents of the only Sway file in the project, and the main entry point, src/main.sw:
以下是项目中唯一的 Sway 文件以及主要入口点 src/main.sw 的内容:
The project is a contract, one of four different project types. For additional information on different project types, see here.
该项目是一个 合约,是四种不同项目类型之一。有关不同项目类型的更多信息,请参阅此处。
We now compile our project with forc build, passing the flag --print-finalized-asm to view the generated assembly:
我们现在使用forc build编译我们的项目,传递标志--print-finalized-asm以查看生成的程序合集:
Last updated