Skip to content

ERC20 token with snapshots #1209

@frangio

Description

@frangio

We should have a flavor of ERC20 that adds snapshotting of balances. This mechanism allows for implementing a number of things such as trustless dividends, weighted voting (think DAOs), and forking.

I wrote an implementation that is quite efficient, with O(log(snapshot count)) cost for retrieving past balances, and relatively small constant overhead for transfers. It can be found in my frangio:feature-snapshot-token branch.

I posted this initially in #991 but can't continue working on it for now due to lack of time. Someone needs to complete the work on it by adding comprehensive tests and documentation, and maybe review some naming. After #1097 is merged it should also account for the new internal _mint and _burn functions. We should measure the gas overhead too. Don't hesitate to ask any questions about it!

There was some previous discussion in #991, and in #1100 which was a proposal of an implementation that turned out to be too costly.

Metadata

Metadata

Assignees

Labels

contractsSmart contract code.featureNew contracts, functions, or helpers.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions