# 智能合约

## Remix

{% embed url="<https://remix.ethereum.org>" %}
在线solidity编辑器
{% endembed %}

[设置DxChain3.0的MetaMask网络](/dxchain-wiki/zhong-wen-she-qu/kai-fa-zhe-wen-dang/qian-bao.md#ce-shi-wang)，Remix的environment中选择 `injected web3` 和 MetaMask网络保持一致。

![](/files/Y9N2LNrMZ3uA8zXnFJNG)

新建`sol` 文件，编写智能合约代码。

```solidity
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20("TestToken", "TT") {}

```

![](/files/yC5pzOP6VqvYHFqCQvaD)

选择适当版本的`solidity`编译器，设置自动编译和编译优化，进行合约编译。

![](/files/I7r9hMJDaOnE9CqIT8T5)

选择 `injected web3` 网络，部署智能合约。

![](/files/UEYlm8hkYcTi9SdWNFQz)

MetaMask 确认交易发送后，完成合约部署。

![](/files/oYQ4XlV5hGPBbqeiUPwy)

## 其他

* hardhat
* truffle
* ......


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dxchain.gitbook.io/dxchain-wiki/zhong-wen-she-qu/kai-fa-zhe-wen-dang/kai-fa-zhe/zhi-neng-he-yue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
