问题一:
TypeError: Data location must be "memory" for parameter in function, but none was given.
解决方案:
找到标注错误的地方,在用到string的时候,在其后面加上memory就可以了。
旧版本
function set(string _name, uint _age) public {
新版本
function set(string memory _name, uint _age) public {
问题二:
TypeError: Invalid type for argument in function call. Invalid implicit conversion from contract DappTokenSale to address requested.
解决办法:
使用address(this)替代this。
旧版本:
require(tokenContract.balanceOf(this) >= _numberOfTokens);(issue is here)
新版本:
require(tokenContract.balanceOf(address(this)) >= _numberOfTokens);(issue is here)
全部评论