-
-
Save IllIllI000/1b70014db712f8572a72378321250058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; | |
/** | |
* @title BoolStateVars | |
* @author IllIllI | |
*/ | |
contract MappingBools { | |
mapping(uint => bool) data; | |
bool data2; | |
// optimize 200 | |
// 43837 gas | |
function set_a81(uint idx, bool value) external { | |
data[idx] = value; | |
} | |
// optimize 200 | |
// 43621 gas | |
function set2(bool value) external { | |
data2 = value; | |
} | |
} | |
contract MappingUint8s { | |
mapping(uint => uint8) data; | |
uint8 data2; | |
// optimize 200 | |
// 43840 gas | |
function set_Hl1r(uint idx, uint8 value) external { | |
data[idx] = value; | |
} | |
// optimize 200 | |
// 43627 gas | |
function set2(uint8 value) external { | |
data2 = value; | |
} | |
} | |
contract MappingUint256s { | |
mapping(uint => uint) data; | |
uint data2; | |
// optimize 200 | |
// *43729 gas* | |
function set_2E3(uint idx, uint value) external { | |
data[idx] = value; | |
} | |
// optimize 200 | |
// *43516* gas | |
function set2(uint value) external { | |
data2 = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment