Dividend ERC20 Token

An ERC20 token that allows the distribution of another, or the same, ERC20 token in the form of dividends.

Dividend Distribution

Each time dividends are distributed, the total dividends variable is updated. It is increased by:

total dividends += dividend amount / total supply

Claiming Dividends

Each time a user claims dividends their last claim is updated. The last claim is the value of the total dividends since their last claim. The amount they can claim is the difference between the total dividends and the last claim multiplied by the amount of tokens that they hold:

(total dividends - last claim) * user token balance = dividends owed 

Each time a user makes a transfer both the recipient and the sender claim their dividends. This is to prevent duplicate claims.

Distributing the Excess Balance

The dividend ERC20 contract should never be able to claim dividends; Instead, the contract's excess dividend token balance should be distributed among everyone else. In order to account for this discrepency the total dividends calculation is modified as so:

total dividends += dividend amount / (total supply - contract balance)

The excess balance in the contract is calculated in the following way and then distributed:

excess balance = dToken balance - (dTokensDistributed - dTokensWithdrawn) 

Last updated