Skip to content

Commit bc0f71d

Browse files
committed
Broaden README header to cover timestamps, oracles, and counters
The old header only mentioned ETH's 18 decimals. The rewrite grounds the cost (20k gas per extra slot) and names the full range of on-chain values that benefit from quantization.
1 parent d774947 commit bc0f71d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
[![Staking Case: Gas Usage Reduction](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/0xferit/uint-quantization-lib/gh-badges/.badges/staking-savings.json)](test/showcase/ShowcaseGas.t.sol)
44
[![Extreme Case: Gas Usage Reduction](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/0xferit/uint-quantization-lib/gh-badges/.badges/extreme-savings.json)](test/showcase/ShowcaseGas.t.sol)
55

6-
Ethereum values use 18 decimals of precision: far more than most contracts need. Trade that excess precision for storage density. Quantize uint256 values into fewer bits than their range requires, packing more data per slot and saving gas.
6+
Token amounts carry 18 decimals of precision. Timestamps fit in 40 bits but live in `uint64`. Oracle prices, counters, accumulated fees: most on-chain values use far more resolution than the application needs, and every extra storage slot costs 20,000 gas on a cold write.
7+
8+
This library quantizes `uint256` values via right-shift compression, packing more fields per storage slot and cutting gas on every write.
79

810
**Quick start:**
911

0 commit comments

Comments
 (0)