i'm studying mastering ethereum with this site. https://github.com/ethereumbook/ethereumbook/blob/develop/09smart-contracts-security.asciidoc
and all of example codes are using uint 256.
for example,
pragma solidity ^0.4.19
contract EtherStore {
//unsigned integer type of 256 bits
uint256 public withdrawalLimit = 1 ether;
mapping(address => uint256) public lastWithdrawTime;
mapping(address => uint256) public balances;
function depositFunds() public payable {
balances[msg.sender] += msg.value;
}
function withdrawFunds (uint256 _weiToWithdraw) public {
...
...
}
}
uint256 public withdrawalLimit = 1 ether;
it use 256 bits just allocate 'integer 1' i think this is waste of memory and gas.
if this value treat to wei, these value only needs 60 bits.
i don't know why this book use 256bits to save '1'
thanks for your help :)