Guess the number
1. 题目
- I’m thinking of a number. All you have to do is guess it.
- 题目代码:
1 | // SPDX-License-Identifier: MIT |
2. 分析
- 2.1 这题是猜数字,但是他的数字是写死的,通过
ethers
读取。 - 2.2 但是部署和 猜数字都需要支付 1ether ,即两个,如果猜对了他就会返回之前支付的ether
3. 解题
3.1 部署,msg.value = 1 ether

3.2 调用 guss() 函数

3.3 查看合约余额
