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

in #utopian-io6 years ago (edited)

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 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:

Sort:  

Hi again, like we talked before the review will be based on this commit

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

For the other part of the review you can check the previous contribution

Good luck with the next features!

Your contribution has been evaluated according to Utopian policies and 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.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks for reminding me of the missing translation. I'm pretty sure @helo will take care of it in no time. :)

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.

Vote for Utopian Witness!

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.

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!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.039
BTC 69796.92
ETH 3521.66
USDT 1.00
SBD 4.70