> ## Documentation Index
> Fetch the complete documentation index at: https://injectivelabs-docs-ai-sdk.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 Foundry 部署智能合约

## 前置条件

你应该已经设置好 Foundry 项目，并成功编译了智能合约。
请参阅[设置 Foundry 并编译智能合约](./compile-foundry/)教程了解如何操作。

可选但强烈推荐：你还应该已经成功测试了智能合约。
请参阅[使用 Foundry 测试智能合约](./test-foundry/)教程了解如何操作。

## 运行部署

运行以下命令来部署智能合约：

```shell theme={null}
forge create \
  src/Counter.sol:Counter \
  --rpc-url injectiveEvm \
  --legacy \
  --account injTest \
  --gas-price 160000000 \
  --gas-limit 2000000 \
  --broadcast
```

<Callout icon="info" color="#07C1FF" iconType="regular">
  请注意，我们使用的是保存到 keystore 的 `injTest` 账户，
  这是之前在[设置 Foundry 并编译智能合约](./compile-foundry/)中设置的。
</Callout>

输出应该类似于：

```text theme={null}
Enter keystore password:
Deployer: 0x58f936cb685Bd6a7dC9a21Fa83E8aaaF8EDD5724
Deployed to: 0x213bA803265386C10CE04a2cAa0f31FF3440b9cF
Transaction hash: 0x6aa9022f593083c7779da014a3032efd40f3faa2cf3473f4252a8fbd2a80db6c
```

复制部署的地址，访问 [`https://testnet.blockscout.injective.network`](https://testnet.blockscout.injective.network/)，并在搜索字段中粘贴地址。
你将访问区块浏览器中你刚刚部署的智能合约页面。

如果你点击 "Contract" 标签，你应该看到该合约的 EVM bytecode，它将与编译后在 artifacts 目录中找到的 EVM bytecode 匹配。

## 下一步

现在你已经部署了智能合约，你可以开始验证该智能合约了！
接下来请查看[使用 Foundry 验证智能合约](./verify-foundry/)教程。
