File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,30 @@ nus 研一 web3小白 通过blockchain 课程接触web3概念 究极P人努力
1919
2020参加今天链上社交分享会 学习了js的相关语法 学成待续
2121
22+ # 2025-08-17
23+
24+ 报错 错误原因
25+ ParserError: Expected identifier but got '('
26+ constrctor( ){ constructor拼写错误
27+ TypeError: Data location must be "memory" or "calldata" for parameter in function,
28+ but none was given.
29+ --> Lab2.sol:12:22:
30+ |
31+ 12 | function add_Qty(uint256[ ] arr) public{
32+ | 局部数组变量必须申明是storage还是memory;对于简单的类型(unit,bool,address)不需要指定memory;对于复杂的引用类型(struct、array、string、bytes)必须指定存储位置是memory或者storage,否则编译会报错
33+ DeclarationError: Undeclared identifier. "sum" is not (or not yet) visible at this point.
34+ --> Lab1exercise.sol:19:25:
35+ |
36+ 19 | uint256 sum=sum+sgd[ i] * qty[ i] ;
37+ | ^^^ 在solidity中循环变量必须在循环体外申明
38+ TypeError: Member "numberOfSides" not found or not visible after argument-dependent lookup in uint256.
39+ --> tests/Lab2_problemsampleanswer/Lab2_p1/Dice1.sol:85:29:
40+ |
41+ 85 | if(newNumber==dices[ diceId.numberOfSides] ){
42+ | ^^^^^^^^^^^^^^^^^^^^ dices mapping类型语法错误 应该是 dices[ diceID] .numberOfSides
43+ ERC20 e = new ERC20(); 创建了一个新的ERC20合约叫e,e所在的合约地址是新的合约地址由new ERC20()看出
44+ 注意:solidity中的private和mapping变量不能直接从外部读取,所以需要用getter的方法,创建一个函数
45+
2246# 2025-08-16
2347
2448web3
You can’t perform that action at this time.
0 commit comments