-
Notifications
You must be signed in to change notification settings - Fork 2k
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
remove Address.sol, replace isContract with address(...).code.length > 0 #817
base: main
Are you sure you want to change the base?
Conversation
代码编译无法通过,最好不要使用内联汇编,这样会增加读者学习代码的成本 |
@@ -13,8 +12,6 @@ import "../34_ERC721/IERC165.sol"; | |||
* 见 https://eips.ethereum.org/EIPS/eip-1155 | |||
*/ | |||
contract ERC1155 is IERC165, IERC1155, IERC1155MetadataURI { | |||
using Address for address; // 使用Address库,用isContract来判断地址是否为合约 | |||
using Strings for uint256; // 使用Strings库 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行不应该删除,会导致编译失败
} else { | ||
/// @solidity memory-safe-assembly | ||
assembly { | ||
revert(add(32, reason), mload(reason)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
内联汇编是否可以修改成可读性更高的
如果大佬没空修改的话,明天我会在你这个分支上修改完,进行合并 |
这个我回退一下版本就行,是merge Main的时候导致的错误,至于内联汇编哪里,我主要参考的是https://github.com/AmazingAng/WTF-Solidity/blob/main/34_ERC721/ERC721.sol |
好的 辛苦了 我最近比较忙 |
What type of PR is this (这是什么类型的PR)
Which issue(s) this PR fixes(Optional) (这个PR 修复了什么问题 (可选择))
What this PR does / why we need it (这个PR 做了什么/ 我们为什么需要这个PR)
to.isContract()报错