Actifit Task: Nodejs script for upvoting, calculating and storing rewards

in #utopian-io6 years ago (edited)

Repository

https://github.com/mcfarhat/actifit

Details

We need to create a Node.js script that handles upvoting and storing relevant ACTIFIT token values, scores and rewards per each user and account that is eligible for reward.
The script's algorithm and technical details would be as follows:

  • we need to constantly check the VP of @actifit account, and do the following when VP reaches 100% AND after at least 24 hours of the last voting round:
  • go through the actifit posts since the last voting round, and pull all the new actifit (unvoted) posts
  • grab post with actifit tag, make sure it contains step_count as part of jsonmetadata and @actifit and @actifit.pay as beneficiaries
  • check step_count value, make sure value is at least 5000, otherwise skip it
  • check if post was upvoted by a bot, bot list source can be fetched from steembottracker API, if so skip the post.
  • compile final list of posts with step_count and current vote value for each
  • calculate and distribute VP across posts so that we do not consume more than 20% VP, as follows:
step_countrate_multipliertoken_count
5,000-5,9990.220
6,000-6,9990.3535
7,000-7,9990.550
8,000-8,9990.6565
9,000-9,9990.880
10,000+1100

which makes the formula as follows:
no_of_posts_10k+ * x * 1 + no_of_posts_9k * x * 0.8 + no_of_posts_8k * x * 0.65 + no_of_posts_7k * x * 0.5 + no_of_posts_6k * x * 0.35 + no_of_posts_5k * x * 0.2 = 1000
we calculate x, and when upvoting each batch of posts, we need to multiply it by the relevant multiplier. So when upvoting top batch, we multiply x by 1 for each vote, ensuring vote doesn't go beyond 100. Same for following ones.

  • In terms of ACTIFIT tokens, those will need to be stored in a database on the same server, as follows:
  • when upvoting, we need to check if the user already has an account stored - need two tables:
  1. user_tokens table: with fields user, total_token_count
  2. token_transactions table: with fields user, reward_activity (values: post, or other options such as moderation, delegation), post_permalink, date, and token_count. User field will be his steemit account name, and the remaining ones are self-explanatory.
  • if user has account, need to increase his token count with the proper amount found in table above, and register a transaction relevant to this. if not, create new account and do same process
  • Calculating actifit tokens for upvoters/resteemers:
  • we also need, for all posts that are being upvoted, to fetch a list of all upvoters and resteemers, those will be rewarded with 1 ACTIFIT token per action (upvote or resteem), and their account value and relevant transactions need to be created for them (reward_activity will be upvote or resteem).

  • need to have end points for calling the scripts and returning user current token count, along prior transactions per each user

  • The full process above needs to be done on the first run for all older posts to calculate and store proper ACTIFIT tokens and transactions for users.

Components

The above task is required to allow completing a part of the cycle for tracking and rewarding posts created via the Android app and all persons who should be accordingly rewarded.

Deadline

I would love for this to be completed the soonest, with deadline being on July 4th, 2018
EDIT: I have someone who started working on this. Agreed that deadline for voting part will be July 4th, while the FINAL DEADLINE for full completion will be on July 11th, 2018

Communication

If you have any questions or would like to contact me for further details on the task or on means of cooperation, feel free to reach out:

Github

https://github.com/mcfarhat

Sort:  

Thanks for the task-request, @mcfarhat! It's a very detailed request, so I think once you find someone capable they shouldn't have a hard time understanding what needs to be completed - good luck!

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

Well done @mcfarhat! You successfully guessed the match result.

Round 16 - France vs Argentina
Click on the badge to view your Board of Honor.
Do you want to know your current ranking? Read this post

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

Well done @mcfarhat! You successfully guessed the match result.

Round 16 - Uruguay vs Portugal
Click on the badge to view your Board of Honor.
Do you want to know your current ranking? Read this post

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

Hey @mcfarhat
Thanks for contributing on Utopian.
We’re already looking forward to your next task request!

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

Vote for Utopian Witness!

Well done @mcfarhat! You successfully guessed the match result.

Round 16 - Croatia vs Denmark
Click on the badge to view your Board of Honor.
Do you want to know your current ranking? Read this post

Do not miss the last post from @steemitboard!


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

Well done @mcfarhat! You successfully guessed the match result.

Round 16 - Brazil vs Mexico
Click on the badge to view your Board of Honor.
Do you want to know your current ranking? Read this post

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Colombia vs England


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

Well done @mcfarhat! You successfully guessed the match result.

Round 16 - Sweden vs Switzerland
Click on the badge to view your Board of Honor.
Do you want to know your current ranking? Read this post

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Round of 16 - Day 3


Do you like the SteemitBoard World Cup Contest?
Vote for @steemitboard as a witness and get one more award!

I would like to give it a try, is this still up? Or is it already done?

sorry already done, but thank you for the interest ! :)

Coin Marketplace

STEEM 0.15
TRX 0.12
JST 0.026
BTC 56787.81
ETH 2507.96
USDT 1.00
SBD 2.24