You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most tokens have 18 decimals and less than a quadrillion circulating
That’s less than 2^128
I still have 70 bytes I can use and I can pack time and amount already
Compressing via uint128 (38 zeros)
We can half the slot required for rewards / shares via
Struct Amount {
uint128 amount0;
uint128 amount1;
}
shares[epochIdMod2][vault][user] =Amount(0, 1);
Meaning each slot for shares now holds 2 balances and each epoch can be found by dividing the epoch by 2 (can be Shifted, so cheaper than division) (using remainder to tell which one of the two you need)
Assuming we do this just for rewards, over 1 year, only considering the cold slot penalty, we're saving 4k gas per claim
The text was updated successfully, but these errors were encountered:
Generic Data
4e11 covers 10 thousand years
2^48 is sufficient
Most tokens have 18 decimals and less than a quadrillion circulating
That’s less than 2^128
I still have 70 bytes I can use and I can pack time and amount already
Compressing via uint128 (38 zeros)
We can half the slot required for rewards / shares via
Assuming we do this just for rewards, over 1 year, only considering the cold slot penalty, we're saving 4k gas per claim
The text was updated successfully, but these errors were encountered: