The Magic Frog: New Pot Calculation and some fixes/improvements (Development Update)

in #utopian-io6 years ago (edited)


image.png

Repository

https://github.com/mktcode/the-magic-frog (Website)
https://github.com/mktcode/the-magic-story-machine (Bot)
https://github.com/mktcode/the-magic-link (API)

About the Project

the-magic-frog.com

The Magic Frog is a Bot/Website utilizing the STEEM blockchain to reward everyone involved in a collaborative storytelling project. By submitting small pieces of text (and even images), 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!

New Pot Calculation

First read more about the rewards system here.

Until now the pot was calculated based on the payout of a story's posts. All the paid and pending author rewards were summed up, curator rewards and beneficiaries were subtracted, then 50 % of that makes the pot (since the posts are set to 50% SBD and 50% SP).

This approach had some drawbacks. The rewards are distributed one day after a story ends. This means that the latest 6-7 posts of that story have not been paid out yet. Of course the calculation could simply ignore those latest posts but in any way those payouts would be "lost" and not distributed to the community.

Another solution would have been to wait for 7 days until the rewards get distributed, so that all the payouts can be used, but that felt just a little bit inconvenient and I simply wanted the rewards to be distributed immediately.

The solution is now much much simpler. The value of the pot for a story is always simply the current SBD balance of the respective frog account. This still means that the payout for the latest 7 posts of a story will not be taken into account for the pot of that story BUT they will automatically go into the pot of the next story, so nothing will be lost. Each story benefits from the last 7 posts of the story before and gives its last 7 post payouts to the next story. So there's some sort carryover happening now.
And after all it takes away some nasty calculation that is just prone to errors and inaccuracy.

This also means that if you want to push a story pot to the moon... just send some SBD to the respective frog account. I don't know why would do that instead of delegating but it's possible.

Implementation

First I updated the API.
Commit: https://github.com/mktcode/the-magic-link/commit/6fcf8422db78b193e814332a675ed10320a80a7b

The /pot endpoint now simply fetches the account data and uses the sbd_balance property as the total pot value.
So there's also no need for a story number anymore, to iterate over all the posts.

Then the bot needed to be updated.
Commit: https://github.com/mktcode/the-magic-story-machine/commit/a329256699942dc5f932b41e0583f1fbe0f682c6

Until then the bot didn't even use the API endpoint but instead calculated everything on its own. So I changed this method so that it simply fetches the pot from the API.
In the bot.js I then needed to adjust those related variables.

Last but not least those changes needed to be correctly displayed on the website as well:
Commit: https://github.com/mktcode/the-magic-frog/commit/42feede95ba7d22089e7c93be65f9a2867a8b2aa

Again the calculation wasn't even based on this API endpoint (Did I maybe just forget to implement that before... who knows? :P)

So now there's a new property in the vuex store and the related action to fetch the data, the mutation and the getter.

The rest then happens in pages/index.js where I dispatch the fetchPot action and adjust the related variables.

And that's it for that part of the update.

Daily Rewards Claiming

Commit: https://github.com/mktcode/the-magic-story-machine/commit/86ad89086353b2bc7241c3186c2eb291c1d89efb

Before, the generated rewards were claimed automatically only when a story ends. Since the pot is now the SBD balance it only made sense to claim the rewards daily. So I got rid of the claimRewards method and merged it into the getAccount method which is called daily, of course.

Therefore it somehow also made sense to me to get the pot value after the rewards are claimed.

This has one drawback compared to before, when the pot was calculated based on individual posts payouts. The displayed pot value on the website was automatically updated with every upvote. Now it gets updated only once a day but hey... you can't have everything.

Better Reading Experience


gif

Someone once told me that it's a bit inconvenient to read the story when every sentence is separated by the usernames of the storytellers, so I added an option to hide them.

Commit: https://github.com/mktcode/the-magic-frog/commit/58b77de872ed508e16d461a5ef4fc438f67bb5a7

There's a new property in the vuex store, the respective getter and mutation and a new button above the story on the home page as well as in the story archive, to toggle this property.

The StoryPart component now reacts to this property and shows or hides the usernames.

And of course for the button label the respective translation keys were added.

Updated Text/Graphics

Some very minor changes were applied to the content of the daily story posts. They now display the fantastic new graphic of the pot full of gold, drawn by the amazing @ienrikex.

Commit: https://github.com/mktcode/the-magic-story-machine/commit/2bb77f41d36af637892ec23fd3814e5a821f6647

And there are some slight changes in the text, i.e. I removed the note about that "bug" in busy.org.

Commit: https://github.com/mktcode/the-magic-story-machine/commit/4a1e8ddaee3104bb097a69c53a84ecc5acf3508a

On the website I also updated the graphics.

Commit: https://github.com/mktcode/the-magic-frog/commit/d014887f34dcea6851fb076f6158a231a3078e7f

Other Commits (Fixes/Improvements)

Sort:  
  • Wow, there is a lot of work here, sparkled all over this post.
  • Yet again, some vue magic. I'm learning every time.
  • Some change in eslint preferences?

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]

Thank you for your review, @helo!

So far this week you've reviewed 8 contributions. Keep up the good work!

This post has been just added as new item to timeline of The Magic Frog on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add The Magic Frog to your favorite projects.

Hey, @mkt!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

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 17 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 6 SBD worth and should receive 102 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

This is so nice well now more earnings

Hi @mkt!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @mkt! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the total payout received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemFest³ - SteemitBoard support the Travel Reimbursement Fund.

Support SteemitBoard's project! Vote for its witness and get one more award!