remix使用_使用Remix展平合同和调试

本文介绍了如何使用Truffle和OpenZeppelin构建简单的智能合约,阐述了展平合约的原因,以及如何利用Remix IDE进行逐步调试。通过实例展示了在Truffle环境下创建自定义令牌,然后使用truffle-flattener合并合约,最后在Remix IDE中部署和调试合约,强调了调试器在确保智能合约无误中的重要性。
摘要由CSDN通过智能技术生成

remix使用

Smart contracts on the Ethereum main-net use real money, so building error-free smart contracts is crucial and requires special tools like debuggers.

以太坊主网上的智能合约使用真实资金,因此构建无错误的智能合约至关重要,并且需要调试器之类的特殊工具。

Remix IDE is the most fully-featured IDE for Solidity. Among other tools, it has an excellent step-by-step debugger. You can perform various tasks such as moving in time, changing the current step, exploring local variables and current state by expanding various panels.

Remix IDE是Solidity中功能最齐全的IDE。 在其他工具中,它具有出色的逐步调试器。 您可以执行各种任务,例如移动时间,更改当前步骤,通过展开各种面板来浏览局部变量和当前状态。

You can also set breakpoints to move between different points in the code. And the terminal allows you to display transactions executed from Remix and debug them.

您还可以设置断点以在代码中的不同点之间移动。 并且终端允许您显示从Remix执行的事务并调试它们。

Throughout this tutorial, we’ll use Truffle and OpenZeppelin to build a simple custom token. We’ll see why and how to flatten the contract, and finally we’ll use Remix IDE to start debugging the contract.

在整个教程中,我们将使用Truffle和OpenZeppelin构建简单的自定义令牌。 我们将了解为什么以及如何展平合同,最后,我们将使用Remix IDE开始调试合同。

为什么要展平智能合约? (Why Flatten a Smart Contract?)

Flattening a smart contract refers to combining all Solidity code in one file instead of multiple source files such that, instead of having imports, the imported code is embedded in the same file. We need to flatten smart contracts for various reasons, such as manually reviewing the contract, verifying the contract on Etherscan, or debugging the contract with Remix IDE, as it currently doesn’t support imports.

展平智能合约是指将所有Solidity代码组合在一个文件中,而不是多个源文件中,从而使导入的代码被嵌入同一文件中,而不是进行导入。 由于各种原因,我们需要展平智能合约,例如手动检查合约,在Etherscan上验证合约或使用Remix IDE调试合约,因为该合约目前不支持导入。

使用Truffle和OpenZeppelin编写简单令牌 (Writing a Simple Token Using Truffle and OpenZeppelin)

Remix IDE is officially recommended for building small contracts or for the sake of learning Solidity, but once you need to build a larger contract or need advanced compilation options, you’ll have to use the Solidity compiler or other tools/frameworks such as Truffle.

正式建议使用Remix IDE来构建小型合同或为了学习Solidity,但是一旦您需要构建较大的合同或需要高级编译选项,则必须使用Solidity编译器或其他工具/框架(例如Truffle)。

Besides error-free contracts, security is also a crucial part of building a smart contract. For this reason, using battle-tested frameworks like OpenZeppelin that provides reusable, well-tested, community-reviewed smart contracts, will help you reduce the vulnerabilities in your Dapps.

除了无差错合同,安全性也是构建智能合同的关键部分。 因此,使用经过测试的框架(如OpenZeppelin)提供可重复使用,经过良好测试,经过社区审查的智能合约,将帮助您减少Dapps中的漏洞。

Let’s now see how we can use Truffle and OpenZeppelin to create a simple custom Token that extends the standard token from OpenZeppelin.

现在,让我们看看如何使用Truffle和OpenZeppelin创建一个简单的自定义令牌,该令牌扩展了OpenZeppelin的标准令牌。

要求 (

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值