4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Dapp-a-day 24: Rate Accumulator

dapp-a-day-24 2x


A Rate Accumulator is a building block for tracking a set of balances with a continuous variable return rate. It will correctly prorate balances in constant time no matter how frequently the rate is updated or balances are changed (each at most once per timestamp).

This comes at a cost of storage space that is linear with number of "points": Any time the rate is changed or a balance is read, a storage slot is polluted forever. Reuse rate accumulators whenever possible - the same accumulator can be used for totally different balance sets with no extra penalty.

https://github.com/nexusdev/ds-rate-accumulator

40 upvotes $6.02

Replies (0)

Conversation

No replies yet

Replies will appear here as people join the conversation.

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: