SteemPlus API Updates : Fix Delegation and Weekly Bonus Payouts + Ads API

Words
323
Reading
2 min
Listen
Play
7y

Hi Steemians,

We have made a few updates, mostly to fix some issues regarding SPP distribution, and to make it easier for us to replay our algorithm after pushing some fixes.

Replay

Something that I ve pushed back for too long and was doing manually every time.
When some new code is pushed and must affect the previous blocks as well, a replay is needed. The database needs to be cleared and all the jobs regarding SPP calculation need to be relaunched.
I've created an endpoint that launches an algorithm to execute this replay.

// Starting replay to get all the SPP since they were released.
    console.log("Starting Replay...");
    console.log("Updating SteemPlus Points for comments transfers and reblogs");
    await spp.updateSteemplusPoints();
    console.log("Done updating SPP");
    console.log("Starting Delegations");
    await spp.payDelegations();
    console.log("Done rewarding delegations");
    console.log("Debiting premium subscriptions");
    await premium.debitPremium();
    console.log("Done debiting");
    console.log("Start paying weekly rewards");
    await spp.payWeeklyRewards();
    console.log("Done paying daily rewards");
    console.log("Loading ads");
    await ads.add();
    console.log("Done loading ads");
    console.log("Done replaying");

You can try and see the calculation of SPP by running localhost:3000/replay/[MASTER]
[MASTER] being a password set in your .env file.

When I ll have time, I ll completely change the SPP calculation to a block streaming method, instead of using SteemSQL.

Fixing SPP rewards for delegations

After talking with masoom@masoom, I realized that delegations rewards were broken in a very specific case : when a user delegated to steem-plus@steem-plus, undelegated then delegated again.
This is now fixed. Delegate to us to get more SPP ! ;)

Fixing SPP weekly bonus rewards

At the end of each week (sunday night), the 10 top SPP earners will get extra SPP.
There was a problem with the computation of this bonus, that has now been fixed. Thanks jason7282@jason7282 for reporting the issue!

For information, you can check your current rank on steemplus.app, on the Ranking tab.

Ads

This update also included the addition of endpoints used for the Ads feature, coming soon on SteemPlus.

Repository:

https://github.com/stoodkev/steemplus-api

Pull Request

Wanna contribute?

Join us on Discord

How to test this code?

  • Subscribe to SteemSQL (10 SBD/month)
  • Clone this repository
  • npm install
  • Set the environment variables (information received by transfer when you subscribe to SteemSQL). These environment variables are LOGIN, PASSWORD, SQL_API and DB.
  • npm run start
  • You should be able to test it on localhost:3000.



@stoodkev and @cedricguillas for @steem-plus

Powered by @adsactly

Powered by @utopian-io

Like what I do? Vote @stoodkev for witness!

SteemPlus API Updates : Fix Delegation and Weekly Bonus Payouts + A... | Ecency