p3d分红逻辑学习

in 互联网前沿
关注公众号【好便宜】( ID:haopianyi222 ),领红包啦~
阿里云,国内最大的云服务商,注册就送数千元优惠券:https://t.cn/AiQe5A0g
腾讯云,良心云,价格优惠: https://t.cn/AieHwwKl
搬瓦工,CN2 GIA 优质线路,搭梯子、海外建站推荐: https://t.cn/AieHwfX9

每次p3d余额变动,就会计算profitPerShare:
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
我的分红余额:
(profitPerShare * myTokenBalanceLedger) - myPayouts

举栗子,我分4次,每次充100个eth,10个拿来作分红,假设剩下的90个按1比1获得90个p3d:

0 0 0
myDividends_result my_payouts profitPerShare dividends(eth) tokenSupply(p3d)
0 0 0 10 90
90 * 1/18 - my_payouts 90 * 1/18 1/18 10 180
270 * (1/27+1/18) - my_payouts 90 * (1/27+1/18) + 90 * 1/18 1/27+1/18 10 270
360 * (1/36+1/27+1/18) - my_payouts 90 * (1/36+1/27+1/18) + 90 * (1/27+1/18) + 90 * 1/18 1/36+1/27+1/18 10 360

计算后的结果是:

0 0 0
myDividends_result my_payouts profitPerShare dividends(eth) tokenSupply(p3d)
0 0 0 10 90
90 * 1/18 90 * 1/18 1/18 10 180
180 * 1/27 + 90 * 1/18 90 * (1/27+1/18) + 90 * 1/18 1/27+1/18 10 270
270 * 1/36 + 180 * 1/27 + 90 * 1/18 90 * (1/36+1/27+1/18) + 90 * (1/27+1/18) + 90 * 1/18 1/36+1/27+1/18 10 360
老币能享受新的分红

https://etherscan.io/address/0xb3775fb83f7d12a36e0475abdd1fca35c091efbe#code

扫一扫关注公众号添加购物返利助手,领红包
Comments are closed.