The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update) by mkt

View this thread on steempeak.com
· @mkt · (edited)
$62.37
The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)
<center>https://the-magic-frog.com/avatar.png</center>

#### Repository
https://github.com/mktcode/the-magic-story-machine

**About the Project**
https://the-magic-frog.com
*The Magic Frog is a Bot/Website utilizing the STEEM blockchain to reward participants for collaboratively telling a story. By submitting small pieces of text, that the community can vote on everyday, the story evolves and sometimes takes quite strange, funny or interesting turns.*

*The Magic Frog is currently available in English, French and German and more languages will follow!*

# Curators were underrated!

For the success of the project I always thought it needs delegators the most. While this might be still true to a certain degree, I totally underrated the curators that give their upvotes everyday and thereby filling the pot with SBD. With more delegation the project would be more independent from those curators/upvotes and this independence is still what I want for the project but I also have to admit that since there are no really big delegations the project would not survive without all the people who support it with their daily upvotes.

Also some inspiring words from the community made me think about this and that I'm maybe missing something important here. While I was still talking to her, @helo was already working on an [endpoint for the API to fetch all the curators](https://busy.org/@helo/the-magic-frog-in-french-development-update-3-by-helo) and their respective upvote values and this actually made me realize how important that is.

Thanks to @helo the top 12 curators are now honored in the Hall of Fame on the website: https://the-magic-frog.com/hall-of-fame

**And they also get a portion of the story pot. Just like the storytellers and delegators. This is what this contribution is about.**

# Updated Reward Distribution

To sum up the reward generation very briefly: The stories are told piece by piece and everyday one such small piece is appended to the story and a new post is published. This means if a story consists of, let's say... 25 small pieces/sentences, there are 25 posts that can generate rewards. The rewards for those posts are set to 50 % SBD and 50 % SP. So half of all the rewards generated by those posts make the final story pot. So if all those 25 posts generated an overall value of 80 $, this means the value of the story pot is 40 SBD. (The rest powers up the account, resulting in even higher rewards in the future.) Those 40 SBD are then split into 4 equal pieces.

- Winning Storyteller: A random person who contributed at least on little piece/sentence to the story.
- Other Storytellers: All other people who helped telling the story, but had no luck in the final raffle.
- Delegators: Everyone who delegated SP to the respective frog account.
- Curators: Everyone who upvoted at least one of the story post.

**I just decided to publish a separate post, explaining the reward generation and distribution in detail.** Stay tuned! There's something in it for everyone!

# Implementation

It's again just this single commit:
https://github.com/mktcode/the-magic-story-machine/commit/9d0b99eeb8293c76b56a807a3856a3d19f680b45

And it's very similar to the delegators reward distribution.

https://github.com/mktcode/the-magic-story-machine/blob/master/helper.js#L87
Here I added a new method to fetch the top 100 curators. So if a story has more than 100 curators... we have a problem. But if too many curators become a problem.... that will be a good problem. For now it's ok like this.

In the main script we count the total curation (rshares) and calculate the percentage of the curator pot that each curator should get.
https://github.com/mktcode/the-magic-story-machine/blob/master/bot.js#L140

For the memo of the transfer I added those two methods:
https://github.com/mktcode/the-magic-story-machine/blob/master/helper.js#L239
https://github.com/mktcode/the-magic-story-machine/blob/master/locales.js#L114

The challenge here was to display the SBD value that a curator has contributed with his upvotes. The API (thanks again @helo) returns a list of curators for the current story, together with the total amount of rshares (reward pool shares) they contributed. So the question is how to get from rshares to SBD. This is how:
https://github.com/mktcode/the-magic-story-machine/blob/master/helper.js#L246

First you get the information about the post reward pool: `steem.api.getRewardFund('post', (err, fund) => { ...`

It contains the current reward pool size and the recent claims:

`const rewardBalance = parseFloat(fund.reward_balance.replace(' STEEM', ''));`
`const recentClaims = parseInt(fund.recent_claims);`

Then you need the current STEEM/SBD ratio:
```
steem.api.getCurrentMedianHistoryPrice((err, price) => {
   const SBDPrice = parseFloat(price.base.replace(' SBD', ''));
   ...
```

And after some brainfuck and research you come up with this:
```
// calculate SBD value for each vote
resolve(rewardBalance / recentClaims * SBDPrice);
```

The result is a factor to multiply the rshares value with, to get it's SBD representation. So in the end, you just have to do this:
https://github.com/mktcode/the-magic-story-machine/blob/master/bot.js#L154
`sbd: curator.rshares * rsharesToSBDFactor`

Simple... isn't it.

# Next Steps
- explain reward system in detail
- stability improvements
- own account creation system
- write visibility task request on Utopian
- provide "closed" versions for schools

# Contribute

If you want to help with the development of this project, contact us on Discord: https://discord.gg/6GKvTC

Or submit Pull Requests for one of the following repositories:

- The Website: https://github.com/mktcode/the-magic-frog
- The Bot: https://github.com/mktcode/the-magic-story-machine
- The API: https://github.com/mktcode/the-magic-link
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id56,453,107
authormkt
permlinkthe-magic-frog-curator-rewards-and-updated-reward-distribution-development-update
categoryutopian-io
json_metadata{"image":["https:\/\/the-magic-frog.com\/avatar.png"],"community":"busy","tags":["utopian-io","development","themagicfrog","funny","story"],"links":["https:\/\/github.com\/mktcode\/the-magic-story-machine","https:\/\/the-magic-frog.com","\/@helo","https:\/\/busy.org\/@helo\/the-magic-frog-in-french-development-update-3-by-helo","\/@helo","https:\/\/the-magic-frog.com\/hall-of-fame","https:\/\/github.com\/mktcode\/the-magic-story-machine\/commit\/9d0b99eeb8293c76b56a807a3856a3d19f680b45","https:\/\/github.com\/mktcode\/the-magic-story-machine\/blob\/master\/helper.js#L87","https:\/\/github.com\/mktcode\/the-magic-story-machine\/blob\/master\/bot.js#L140","https:\/\/github.com\/mktcode\/the-magic-story-machine\/blob\/master\/helper.js#L239"],"format":"markdown","app":"busy\/2.5.2","users":["helo"]}
created2018-07-13 19:46:57
last_update2018-07-13 20:51:12
depth0
children4
net_rshares27,507,796,179,281
last_payout2018-07-20 19:46:57
cashout_time1969-12-31 23:59:59
total_payout_value47.413 SBD
curator_payout_value14.954 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length5,825
author_reputation44,782,786,305,028
root_title"The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (45)
@trufflepig ·
**Congratulations!** Your post has been selected as a daily Steemit truffle! It is listed on **rank 13** of all contributions awarded today. You can find the [TOP DAILY TRUFFLE PICKS HERE.](https://steemit.com/@trufflepig/daily-truffle-picks-2018-07-14) 
    
I upvoted your contribution because to my mind your post is at least **10 SBD** worth and should receive **111 votes**. It's now up to the lovely Steemit community to make this come true.

I am `TrufflePig`, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, [you can find an explanation here!](https://steemit.com/steemit/@trufflepig/weekly-truffle-updates-2018-27)
    
Have a nice day and sincerely yours,
![trufflepig](https://raw.githubusercontent.com/SmokinCaterpillar/TrufflePig/master/img/trufflepig17_small.png)
*`TrufflePig`*
    
properties (22)
post_id56,531,612
authortrufflepig
permlinkre-the-magic-frog-curator-rewards-and-updated-reward-distribution-development-update-20180714t154113
categoryutopian-io
json_metadata{}
created2018-07-14 15:41:15
last_update2018-07-14 15:41:15
depth1
children0
net_rshares0
last_payout2018-07-21 15:41:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length885
author_reputation37,535,693,521,838
root_title"The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@gregory.latinier ·
Hi again, like we talked before the review will be based on this [commit](https://github.com/mktcode/the-magic-story-machine/commit/9d0b99eeb8293c76b56a807a3856a3d19f680b45#diff-720e1df800dfb9096d48e894cc6e90b0R121)

Let's go for the review, it's gonna be short one as there is not much code

- You comments don't bring much additional value to the code

- https://github.com/mktcode/the-magic-story-machine/commit/9d0b99eeb8293c76b56a807a3856a3d19f680b45#diff-720e1df800dfb9096d48e894cc6e90b0R121 => This is not French :D

- https://github.com/mktcode/the-magic-story-machine/blob/9d0b99eeb8293c76b56a807a3856a3d19f680b45/locales.js#L114 => Why is it repeated twice?

For the other part of the review you can check the [previous contribution](https://steemit.com/utopian-io/@helo/the-magic-frog-in-french-development-update-3-by-helo)

Good luck with the next features!

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/1331234).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , ,
properties (23)
post_id56,753,634
authorgregory.latinier
permlinkre-mkt-the-magic-frog-curator-rewards-and-updated-reward-distribution-development-update-20180716t200135630z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit\/0.1","links":["https:\/\/github.com\/mktcode\/the-magic-story-machine\/commit\/9d0b99eeb8293c76b56a807a3856a3d19f680b45#diff-720e1df800dfb9096d48e894cc6e90b0R121","https:\/\/github.com\/mktcode\/the-magic-story-machine\/blob\/9d0b99eeb8293c76b56a807a3856a3d19f680b45\/locales.js#L114","https:\/\/steemit.com\/utopian-io\/@helo\/the-magic-frog-in-french-development-update-3-by-helo","https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/1331234","https:\/\/support.utopian.io\/","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"]}
created2018-07-16 20:01:36
last_update2018-07-16 20:01:36
depth1
children1
net_rshares6,269,659,100
last_payout2018-07-23 20:01:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,361
author_reputation34,232,959,354,657
root_title"The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (4)
@mkt ·
$0.04
Thanks for reminding me of the missing translation. I'm pretty sure @helo will take care of it in no time. :)
πŸ‘  
properties (23)
post_id56,755,661
authormkt
permlinkre-gregorylatinier-re-mkt-the-magic-frog-curator-rewards-and-updated-reward-distribution-development-update-20180716t202919210z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"busy","links":["\/@helo"],"format":"markdown","app":"busy\/2.5.2","image":[],"users":["helo"]}
created2018-07-16 20:29:21
last_update2018-07-16 20:29:21
depth2
children0
net_rshares21,916,220,536
last_payout2018-07-23 20:29:21
cashout_time1969-12-31 23:59:59
total_payout_value0.044 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length109
author_reputation44,782,786,305,028
root_title"The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@utopian-io ·
Hey @mkt
**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
πŸ‘  
properties (23)
post_id56,894,039
authorutopian-io
permlinkre-the-magic-frog-curator-rewards-and-updated-reward-distribution-development-update-20180718t034509z
categoryutopian-io
json_metadata{"app":"beem\/0.19.42"}
created2018-07-18 03:45:09
last_update2018-07-18 03:45:09
depth1
children0
net_rshares5,838,392,836
last_payout2018-07-25 03:45:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length295
author_reputation152,913,012,544,965
root_title"The Magic Frog: Curator Rewards and updated Reward Distribution! (Development Update)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)