Coder Social home page Coder Social logo

erc20-snapshot-vault's Introduction

ClaimToken.sol

This is the ERC-20 compatible token that represents a holder's claim to a share of the Vault's distribution. It uses OpenZeppelin's ERC20Snapshot internally to keep track of historical token balances at certain points in time.

Vault.sol

This is the contract in which the distributions are stored. It also stores internally an address of a deployed ClaimToken.sol whose proportional balances of the token supply will represent the proportional right to claim distributions from the Vault. The vault supports distribution of multiple tokens that must be designated at deploy-time. This is unalterable once the contract has been launched.

Dividend Creation

When a dividend is created in the Vault (by calling createDividend()), a snapshot of the Vault's token supplies (designated at contract deployment) and the ClaimToken's balances are taken. With this data, each shareholder's rightful share can be calculated when said shareholder goes to make a claim.

Dividend Claiming

Dividends will need to be claimed by the appropriate shareholder. If someone is not a shareholder, their transaction won't be reverted, but rather it will simply send an amount of 0 tokens of the distribution token(s) to msg.sender. Shareholders must claim their rightful share for each dividend individually. Each dividend's full value will be distributed at once. There is no option to make a partial claim of one dividend.

Permissions

The Vault has no special privledging. However, the createDividend() function is rate-limited to prevent spamming as OpenZeppelin's ERC20Snapshot does incur an overhead as snapshot total grows (although its growth is logarthmic).

RateLimiter.sol

A general-purpose library that can be used create a rate limiter. It takes two storage pointers (supported by OpenZeppelin's StorageSlot.sol) so that it can read/write to the consuming contract's storage.

erc20-snapshot-vault's People

Contributors

hrikb avatar

Watchers

 avatar

Forkers

owlprotocol

erc20-snapshot-vault's Issues

Permission-less Checkpointing

Permissionless Checkpointing

ERC20Snapshot has limitations due to the overhead introduced by snapshots. The function has to be permissioned to a certain degree to avoid spam. However, if a single EOA controls whether dividends are issued this is unacceptable as well. Without changing the current smart contract, we can resolve this by implementing more permissionless logic using a proxy contract that implements the rate limiting or some other solution to enable anyone to trigger the contract.

Multi-token

Support snapshotting multiple ERC20 tokens and distributing them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.