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

fix: typos #1063

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
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 basic/07-hardhat/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,4 @@ Changing greeting from 'Hello, world!' to 'hello Dapp-Learning!'
- hardhat 中文文档: <https://learnblockchain.cn/docs/hardhat/getting-started/>
- ethers.js 和 hardhat 基础使用讲解: <https://www.bilibili.com/video/BV1Pv411s7Nb>
- <https://rahulsethuram.medium.com/the-new-solidity-dev-stack-buidler-ethers-waffle-typescript-tutorial-f07917de48ae>
- erc20 openzepplin介绍: <https://segmentfault.com/a/1190000015400380>
- erc20 openzeppelin介绍: <https://segmentfault.com/a/1190000015400380>
2 changes: 1 addition & 1 deletion basic/07-hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,4 @@ Changing greeting from 'Hello, world!' to 'hello Dapp-Learning!'
- hardhat chinese document: <https://learnblockchain.cn/docs/hardhat/getting-started/>
- the usage of ethers.js and hardhat : <https://www.bilibili.com/video/BV1Pv411s7Nb>
- <https://rahulsethuram.medium.com/the-new-solidity-dev-stack-buidler-ethers-waffle-typescript-tutorial-f07917de48ae>
- erc20 openzepplin introduction: <https://segmentfault.com/a/1190000015400380>
- erc20 openzeppelin introduction: <https://segmentfault.com/a/1190000015400380>
2 changes: 1 addition & 1 deletion basic/08-hardhat-graph/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ subgraph 定义了你希望通过 GraphQL API 提供的数据、数据源和数
- https://dev.to/dabit3/building-graphql-apis-on-ethereum-4poa
- https://learnblockchain.cn/article/2566
- https://blog.openzeppelin.com/subgraphs-announcement
OpenZeppelin subgraphs 库: 为常用的 OpenZepplin 合约建立 subgraphs
OpenZeppelin subgraphs 库: 为常用的 OpenZeppelin 合约建立 subgraphs
- https://github.com/graphprotocol/agora
成本模型
- Subgraph 选择指南(分析节点成本,收益以及应该索引哪些 Subgraph):
Expand Down
2 changes: 1 addition & 1 deletion basic/08-hardhat-graph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ reference document for this project:
- https://dev.to/dabit3/building-graphql-apis-on-ethereum-4poa
- https://learnblockchain.cn/article/2566
- https://blog.openzeppelin.com/subgraphs-announcement
OpenZeppelin subgraphs libraray: set subgraphs for the usual contracts of OpenZepplin
OpenZeppelin subgraphs libraray: set subgraphs for the usual contracts of OpenZeppelin
- https://github.com/graphprotocol/agora
cost model
- Subgraph usage(Analyze node costs, benefits, and which subGraphs should be indexed):
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/AccessControl.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "AccessControl",
"sourceName": "contracts/openzepplin/AccessControl.sol",
"sourceName": "contracts/openzeppelin/AccessControl.sol",
"abi": [
{
"anonymous": false,
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/Context.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "Context",
"sourceName": "contracts/openzepplin/Context.sol",
"sourceName": "contracts/openzeppelin/Context.sol",
"abi": [],
"bytecode": "0x",
"deployedBytecode": "0x",
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/ERC165.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "ERC165",
"sourceName": "contracts/openzepplin/ERC165.sol",
"sourceName": "contracts/openzeppelin/ERC165.sol",
"abi": [
{
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/IAccessControl.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "IAccessControl",
"sourceName": "contracts/openzepplin/AccessControl.sol",
"sourceName": "contracts/openzeppelin/AccessControl.sol",
"abi": [
{
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/IERC165.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "IERC165",
"sourceName": "contracts/openzepplin/IERC165.sol",
"sourceName": "contracts/openzeppelin/IERC165.sol",
"abi": [
{
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/ABI/Strings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "Strings",
"sourceName": "contracts/openzepplin/Strings.sol",
"sourceName": "contracts/openzeppelin/Strings.sol",
"abi": [],
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212201791a338d0837bc29fad8f6e4410b26ee3882a43c216ed476afaf3a06184260764736f6c63430008000033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212201791a338d0837bc29fad8f6e4410b26ee3882a43c216ed476afaf3a06184260764736f6c63430008000033",
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python scripts/1_deploy_using_web3.py
## 根据已存在的合约地址构造合约实例
python scripts/2_play_around_on_existing_contract.py

## 使用 openzepplin 合约演示转账
## 使用 openzeppelin 合约演示转账
python scripts/3_use_openzeppelin.py

## 演示 ERC20 合约的调用
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python scripts/1_deploy_using_web3.py
## Construct a contract instance based on the existing contract address
python scripts/2_play_around_on_existing_contract.py

## Demo of transfer using openzepplin contract
## Demo of transfer using openzeppelin contract
python scripts/3_use_openzeppelin.py

## Demonstrate the call of the ERC20 contract
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/contracts/erc20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

import "./ierc20.sol";
import "./erc20metadata.sol";
import "./openzepplin/Context.sol";
import "./openzeppelin/Context.sol";

/**
* @dev Implementation of the {IERC20} interface.
Expand Down
2 changes: 1 addition & 1 deletion basic/18-web3py/contracts/my_erc20_openzeppelin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "./erc20.sol";
import "./openzepplin/AccessControl.sol";
import "./openzeppelin/AccessControl.sol";

contract MyTokenOpenZeppelin is ERC20 {
constructor(uint256 initialSupply) public ERC20("MyTokenOpenZeppelin", "MTOZ") {
Expand Down
6 changes: 3 additions & 3 deletions basic/24-upgradeable-contract/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ ProxyAdmin 提供两个方法进行升级
- 知乎王大锤:<https://zhuanlan.zhihu.com/p/40598039>
- 知乎王大锤:<https://zhuanlan.zhihu.com/p/40598169>
- 合约代码:<https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/tree/master/contracts/proxy>
- openzepplin test: <https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable>
- openzepplin: <https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies>
- openzepplin: <https://blog.openzeppelin.com/proxy-patterns/>
- openzeppelin test: <https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable>
- openzeppelin: <https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies>
- openzeppelin: <https://blog.openzeppelin.com/proxy-patterns/>
- testcase: <https://forum.openzeppelin.com/t/openzeppelin-upgrades-step-by-step-tutorial-for-truffle/3579>
- 原理介绍:<https://www.jianshu.com/p/3fa12d7ed76d>
- compound: 合约升级
Expand Down
6 changes: 3 additions & 3 deletions defi/Compound/contract/Compound合约升级模式.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> 本文为原创文章,如需转载请联系作者。

在keegan小钢的文章:https://learnblockchain.cn/article/2618 提到了compound的合约升级模式,但是它并未详细的说明compound到底是怎样实现合约升级的,以及与openzepplin的合约升级对比,有什么优势。借助本篇文章,我们就详细讨论下compound的合约升级是如何实现,以及它的优缺点。
在keegan小钢的文章:https://learnblockchain.cn/article/2618 提到了compound的合约升级模式,但是它并未详细的说明compound到底是怎样实现合约升级的,以及与penzepplin的合约升级对比,有什么优势。借助本篇文章,我们就详细讨论下compound的合约升级是如何实现,以及它的优缺点。

本文的参考链接如下:https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/

Expand Down Expand Up @@ -356,7 +356,7 @@ contract Vault {

### **透明代理合约**

为了解决升级管理函数中提到的函数选择器碰撞问题,openzeplin提出了透明代理合约。即在fallback函数和proxy中的其他函数中添加一个路由,以此确定合约的正确调用。确保用户只能够调用代理合约中的fallback函数,而admin不能够调用代理合约中的fallback函数,用户在调用到代理合约的其他函数时,会被自动转向到fallback函数中去。
为了解决升级管理函数中提到的函数选择器碰撞问题,openzeppelin提出了透明代理合约。即在fallback函数和proxy中的其他函数中添加一个路由,以此确定合约的正确调用。确保用户只能够调用代理合约中的fallback函数,而admin不能够调用代理合约中的fallback函数,用户在调用到代理合约的其他函数时,会被自动转向到fallback函数中去。

```
//proxy contract
Expand Down Expand Up @@ -500,7 +500,7 @@ contract Impl{

但是这样做的缺点也很明显:添加了多余的不需要的全局变量。并且降低了重复利用率,且容易遗忘出错。

为了解决这个问题,Openzepplin提出了非结构化存储的解决方案,即设定一个固定的slot用于存储impl地址,与合约中的其他全局变量顺序无关。
为了解决这个问题,OpenZeppelin提出了非结构化存储的解决方案,即设定一个固定的slot用于存储impl地址,与合约中的其他全局变量顺序无关。

在EIP-1967中,该固定的slot地址被标准化为:

Expand Down
8 changes: 4 additions & 4 deletions nft/ERC721A/ERC721A.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## 参考链接:

1. [Openzeppelin的EIP721实现](https://learnblockchain.cn/article/3041)
1. [OpenZeppelin的EIP721实现](https://learnblockchain.cn/article/3041)
2. [Azuki的EIP721A实现](https://www.azuki.com/erc721a)

## OpenZepplin实现的缺点
## OpenZeppelin实现的缺点

在一个典型的NFT中,通常会利用OZ的EIP721模板来做如下实现:

Expand Down Expand Up @@ -63,7 +63,7 @@ function _mint(address to, uint256 tokenId) internal virtual {

## ERC721A的改进

从Openzeppelin的实现缺点来看,其主要缺点在于没有提供批量Mint的API,使得用户批量Mint时,其算法复杂度达到O(N).故ERC721A提出了一种批量Mint的API,使得其算法复杂度降为O(1).
从OpenZeppelin的实现缺点来看,其主要缺点在于没有提供批量Mint的API,使得用户批量Mint时,其算法复杂度达到O(N).故ERC721A提出了一种批量Mint的API,使得其算法复杂度降为O(1).

### 最简单的想法:

Expand Down Expand Up @@ -182,7 +182,7 @@ function tokenOfOwnerByIndex(address owner, uint256 index) public view override

## ERC721A 算法的局限性

从上面的分析可以看出,ERC721A算法相较于Openzeppelin的EIP721实现有比较大的突破,但是也有自身的局限性。还有部分我暂未理解清楚:
从上面的分析可以看出,ERC721A算法相较于OpenZeppelin的EIP721实现有比较大的突破,但是也有自身的局限性。还有部分我暂未理解清楚:

局限性:

Expand Down
Loading