// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
// contract SetNonZero {
// uint256 private number = 0;
// // transaction cost --Gas used: 43300
// //execution cost:22236
// function set() external {
// number = 1;
// }
// }
contract SetZero {
uint256 private number = 1;
// transaction cost --Gas used: 21400
//execution cost:5136
function set() external {
number = 0;
}
}
在将一个值从非零改为零时,可以给您一个燃气值的退款(Rsclear)(在执行价格上折扣),退款的上限是总交易费用的最高20%,而且只有当交易费用至少为24,000燃气时才能获得退款。