Skip to content

Commit

Permalink
Merge pull request #718 from Alexzhuangyao/dev_zy_0506
Browse files Browse the repository at this point in the history
[issue:674]update pic of 11_Modifier
  • Loading branch information
AmazingAng committed May 12, 2024
2 parents 3a2ab1e + a64b065 commit 3b8f36f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Binary file modified 11_Modifier/img/11-1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 11_Modifier/img/11-2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 11_Modifier/img/11-3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 11_Modifier/img/11-4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions 11_Modifier/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,19 @@ function changeOwner(address _newOwner) external onlyOwner{

`Owner.sol` 为例。

1. 在 Remix 上编译部署代码。
1. 在 Remix 上编译并部署代码,在合约部署时传入 initialOwner 变量。

![11-1](./img/11-1.jpg)
2. 点击 `owner` 按钮查看当前 owner 变量。

![11-1](img/11-1.jpg)
![11-2](./img/11-2.jpg)
3. 以 owner 地址的用户身份,调用 `changeOwner` 函数,交易成功。

![11-2](img/11-2.jpg)
![11-3](./img/11-3.jpg)
4. 以非 owner 地址的用户身份,调用 `changeOwner` 函数,交易失败,因为modifier onlyOwner 的检查语句不满足。

![11-3](img/11-3.jpg)
![11-4](./img/11-4.jpg)

## 总结

这一讲,我们介绍了`Solidity`中的构造函数和修饰符,并举了一个控制合约权限的`Ownable`合约。
这一讲,我们介绍了`Solidity`中的构造函数和修饰符,并写了一个控制合约权限的`Ownable`合约。

0 comments on commit 3b8f36f

Please sign in to comment.