6

I'm trying to develop a smart contract where dividends are distributed to all token holders. So if there are 100 tokens Alice has 50, Bob has 30 and the other 20 are owned by maybe even thousand different addresses. And there is 200 ether to be distributed as dividends Alice gets 100, Bob 60 and the remaining goes to all others accordingly.

So far I've come up with a burn scheme where you need to burn your tokens to get your portion of ether in the smart contract. However this requires you to burn your shares and you can no longer get the rewards from future profit.

Looping over all token holders is not an option because you would run into gas issues very soon.

Is there already a known solution for this in solidity? Or might the burning scheme be the best solution as it is a incentive to hold?

2 Answers 2

3

If the divident payments don't happen very often, you can have the investors send a transaction when they want to claim their dividend, either specifying a particular dividend or looping through a (reasonably short) list or parameter-defined subset thereof. That avoids the need to loop through the investors, and is generally easier to protect against mischief.

2
  • 2
    This is a solid option. But what do I do to prevent token holders from claiming dividend and then sending their tokens to another address and claim again. Halting transfer seems to overcome that issue but seems quite radical. I would also like if investors can claim dividends any time they like. Commented Dec 14, 2016 at 14:12
  • You're right, you also have to keep a record on transfers so you can calculate how much a user had at a given time. You need users to be able to prove they had balance x as of date y. For instance you can keep a per-user balance for shares at last payment date, and share changes since the last payment date. The latter gets updated whenever they send or receive shares. Commented Dec 14, 2016 at 21:39
1

A (standard?) solution is to calculate the dividend to be redeemed to each address and let address' holders claim this dividend as they wish via a specific method call on your contract. That's what the infamous DAO was planning to do in any case (https://github.com/slockit/DAO/wiki/Understanding-the-DAO-accounting).

Note that your dividend calculation may need to be slightly updated if it is depending on the total token holding including dividends of without dividends.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.