JoinSEEDS / seeds-smart-contracts

Smart contracts for SEEDS - A Regenerative Civilization Building Game.
https://docs.google.com/document/d/1C4w9Ol8VGabCIcQDVPDrwcTRoJXBqhrb7VjslwQbUGU/edit#heading=h.6f4sxygso816
MIT License
20 stars 6 forks source link

Make garner action time-aware #478

Open chuck-h opened 2 months ago

chuck-h commented 2 months ago

The principal use case for the garner action is demurrage.

In this use case every account is "taxed" at a certain rate per period (e.g. 2% per month). In this improvement, the token contract will remember the last time demurrage was successfully transferred out of each account. The withdrawal amount will be computed as demurrage-rate x elapsed-time-since-last-garner . Suppose we make the transaction fail if the elapsed time is below a threshold; then the action becomes sort of idempotent (call it several times in a row and it only withdraws once).

This makes garner scheduling less important and handles failed transactions better.

Perhaps create the table entry only on first garner action, and charge the RAM to the withdrawer.