Cover photo

5 分钟快速部署智能合约到 Arbitrum

本教程手把手教你 5 分钟部署合约到 Arbitrum

1、打开 Remix,创建一个 .sol结尾的文件

https://remix.ethereum.org/

post image

2、将智能合约代码,粘贴到右侧的编辑器

下方为示例发布一个 Token 的代码,你可以在浏览器找自己想要部署的合约,修改后进行部署。

post image
pragma solidity ^0.7.0;

import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/token/ERC20/ERC20.sol';

// This ERC-20 contract mints the specified amount of tokens to the contract creator.
contract first is ERC20 {
  constructor(uint256 initialSupply) ERC20("first token", "FIRST") public {
    _mint(msg.sender, initialSupply);
  }
}

3、如下图切换导航,并点击 Compile,并等待成功

post image

4、连接钱包,填写数量

切换 Environment,选择 Injected Provider,并连接 MetaMask,选择所要连接的钱包。(注意:钱包提前切换到 Arbitrum 网络)

填写数量注意事项:

在 Deploy 按键的旁边输入 Token 数额,假设我们现在要部署 1亿枚 Token。但由于此合约默认位数为小数点后 18 位,因此您需要在输入框内输入:100000000000000000000000000

post image

5、Deploy 合约,修改 Gas,完成部署

注意:默认推荐的 Gas 很高,建议修改为 Low 或者 Market

post image

6、合约部署成功

可以在 MetaMask 钱包看到成功记录。左侧也可以展开合约,进行交互。

post image