在做项目时abi.encode由于参数过多 , 出现 Stack too deep时怎么办
在函数中 使用大括号 把代码分块:
function g() external { bytes memory data1; { data1 = abi.encodePacked(a, b, c, d); } { data1 = abi.encodePacked(data1, e, f, g, h); } }
或者 拆分为不同的函数来完成。
解决问题了,谢谢!