I have some exp with this kind of topic “Dividend Token”. Just share some thoughts
What is “Dividend Token”?
You should search for more detail. =]] But you can go with some token like BabyCake, SafeMoon, ThunderCake, … cake family. :3
The token has some tax or fee on each transaction (transfer, buy, sell) for:
- 1. Reflection reward on other coins to all holders
- 2. Buyback to increase token buy volume
- 3. Burn as disinflation policy
- 4. Add LP to make the token is more stable
- …
I just focus on “Reflection reward”, how to make it fair and scalable.
Reflection reward
- If you think you make a loop to update the reward to all holders -> reject that idea. 😀 the max loop in the contract is about 2500 only. The blockchain has not limited your contract storage but it has limitations on block gas per each transaction. You need to find a solution with O(1) complexity.
function testLongLoopRead() public pure returns (uint length) {
uint sum = 0;
for(uint i = 0; i < 2500; i++) {
sum += 1;
}
return sum;
}
- You can go with “ERC-1726: Dividend-Paying Token Standard” approach which applied on BabyCake/ThunderCake. But there some limitation I know that the reward depends on sale transaction:
- Buy/Transfer: snapshot tax amount to dividend tracker
- Sell transaction:
+ If tax pool > swapTokensAtAmount -> buy reward coin -> If reward coin > 0 -> user can get withdrawableDividendOf and manual claim
+ If process gas > 0 && claimWait is valid -> reward auto distribute to holders depend on gas size.
---- If there are only buy/transfer transaction, user will not get any reward. If process gas too small or swapTokensAtMount too large and just a few sell amount while a lot holders, you have to wait very long time. :3
- Another approach: ERC2917
- This is my formula — I think it’s fair, user can get the reward immediately if there is any transaction occur: https://github.com/nhancv/nideas/blob/main/RewardSharing.pdf