将Remix作为代码查看器

通过 Etherscan

在Etherscan上验证的合约可以通过对URL进行简单更改在Remix中查看。对于大部分合约验证,Remix提供了一种快速加载所有合约的方法。

合约地址的典型 Etherscan URL如下所示:

https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7

在URL中,将etherscan.io更改为remix.ethereum.org

https://remix.ethereum.org/address/0xdac17f958d2ee523a2206206994597c13d831ec7

并重新加载。它将获取在Etherscan上验证的合同。

在以太坊主网和其他测试网络 (Ropsten、Rinkeby、Kovan和Goerli) 上验证的合约将加载到 etherscan-code-sample 工作空间的相应目录下。

这适用于Etherscan测试网址 https://ropsten.etherscan.iohttps://goerli.etherscan.io/等。如果它们被更新,则合约将在Remix中加载。

通过 GitHub

GitHub 上的 Solidity 文件可以通过类似的调整在 Remix 上加载。对于像这样的 URL 文件:

https://github.com/ethereum/remix-project/blob/master/apps/remix-ide/contracts/app/solidity/mode.sol

github.com更改为remix.ethereum.org,如下所示:

https://remix.ethereum.org/ethereum/remix-project/blob/master/apps/remix-ide/contracts/app/solidity/mode.sol

然后重新加载即可。它将在 Remix IDE 中打开相同的文件。