Skip to content

Commit

Permalink
Merge pull request #706 from XdpCs/typo/17
Browse files Browse the repository at this point in the history
docs(017): fix typo
  • Loading branch information
AmazingAng committed May 12, 2024
2 parents c0f4f94 + 0976996 commit 0b72705
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 17_Library/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tags:
所有代码和教程开源在 github: [github.com/AmazingAng/WTFSolidity](https://github.com/AmazingAng/WTFSolidity)

---
这一讲,我们用`ERC721`的引用的库合约`String`为例介绍`Solidity`中的库合约(`Library`),并总结了常用的库合约。
这一讲,我们用`ERC721`的引用的库合约`Strings`为例介绍`Solidity`中的库合约(`Library`),并总结了常用的库合约。

## 库合约

Expand All @@ -34,9 +34,9 @@ tags:
3. 不能接收以太币
4. 不可以被销毁

## String库合约
## Strings库合约

`String库合约`是将`uint256`类型转换为相应的`string`类型的代码库,样例代码如下:
`Strings库合约`是将`uint256`类型转换为相应的`string`类型的代码库,样例代码如下:

```solidity
library Strings {
Expand Down Expand Up @@ -104,7 +104,7 @@ library Strings {

### 如何使用库合约

我们用`String`库合约的`toHexString()`来演示两种使用库合约中函数的办法。
我们用`Strings`库合约的`toHexString()`来演示两种使用库合约中函数的办法。

1. 利用using for指令

Expand Down Expand Up @@ -134,9 +134,9 @@ library Strings {

## 总结

这一讲,我们用`ERC721`的引用的库合约`String`为例介绍`Solidity`中的库合约(`Library`)。99%的开发者都不需要自己去写库合约,会用大神写的就可以了。我们只需要知道什么情况该用什么库合约。常用的有:
这一讲,我们用`ERC721`的引用的库合约`Strings`为例介绍`Solidity`中的库合约(`Library`)。99%的开发者都不需要自己去写库合约,会用大神写的就可以了。我们只需要知道什么情况该用什么库合约。常用的有:

1. [String](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/utils/Strings.sol):将`uint256`转换为`String`
1. [Strings](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/utils/Strings.sol):将`uint256`转换为`String`
2. [Address](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/utils/Address.sol):判断某个地址是否为合约地址
3. [Create2](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/utils/Create2.sol):更安全的使用`Create2 EVM opcode`
4. [Arrays](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/4a9cc8b4918ef3736229a5cc5a310bdc17bf759f/contracts/utils/Arrays.sol):跟数组相关的库合约

0 comments on commit 0b72705

Please sign in to comment.