Gas优化专栏:01 constant、immutable、变量
运行 根据Foundry 官方文档配置好运行环境后,于本项目下执行下列命令,即可看到实际 gas 差异对比。
Copy
forge test --contracts 01_Constant/Constant.t.sol --gas-report
功能简述
constant…
WTF Gas Optimization
Solidity gas optimization techniques, using Foundry. 总结写 Solidity 智能合约更省 gas 的技巧。 大纲
1. use constant and immutable
2. use calldata over…