> For the complete documentation index, see [llms.txt](https://dxchain.gitbook.io/dxchain-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dxchain.gitbook.io/dxchain-wiki/zhong-wen-she-qu/kai-fa-zhe-wen-dang/kai-fa-zhe/zhi-neng-he-yue.md).

# 智能合约

## 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
* ......
