Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决Safemath 库连接失效问题 #752

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion S05_Overflow/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract Token {

## 预防办法

1. Solidity `0.8.0` 之前的版本,在合约中引用 [Safemath 库](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol),在整型溢出时报错。
1. Solidity `0.8.0` 之前的版本,在合约中引用 [Safemath 库](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/utils/math/SafeMath.sol),在整型溢出时报错。

2. Solidity `0.8.0` 之后的版本内置了 `Safemath`,因此几乎不存在这类问题。开发者有时会为了节省gas使用 `unchecked` 关键字在代码块中临时关闭整型溢出检测,这时要确保不存在整型溢出漏洞。

Expand Down