在构造函数中使用多个参数时,与solidity中的编译错误有关



编译器错误:堆栈太深。在启用优化器的同时,尝试使用--via-ir(cli(或等效的viaIR: true(标准JSON(进行编译。否则,请尝试删除局部变量。编译内联程序集时:变量dataEnd在堆栈内的1个槽太深。

constructor(address _escrow, uint256 _Presale_Start_Countdown, uint256 _Presale_End_Countdown,  uint256 _Softcap_End_Countdown, uint256 _Hardcap_End_Countdown, address _funder1, 
address _funder2, address _funder3, address _Development, address _Marketing, address _Community, address _TokenStability, uint256 _DropTokens ) public {
Presale_Start_Countdown = _Presale_Start_Countdown;
Presale_End_Countdown = _Presale_End_Countdown;
require(_escrow != address(0));
escrow = _escrow;
DropTokens = _DropTokens;
presaleSupply_ = 3000000000000000000000000;
funder1 = _funder1;
funder2 = _funder2;
funder3 = _funder3;
Development = _Development;
Marketing = _Marketing;
Community = _Community;
TokenStability =_TokenStability;
balance[escrow] += DropTokens;
balance[escrow] += presaleSupply_;
}

为什么在构造函数中得到很多参数?,我建议你在构造函数中设置重要的参数,然后你可以通过set方法设置其他参数,也可以检查你是否通过所有者专用修饰符设置了函数

最新更新