Help us fix a DLease Bug - 200 BUILDTEAM + 200 STEEM Bounty

As you all probably know by now, DLease is an excellent way for those with a lot of STEEM POWER to grow their investments, and those who want more STEEM POWER for a limited time to find what they need.

Especially now after HF21 with the curation rewards being 50% of the post payout instead of 25%, having a lot of STEEM POWER is beneficial.

With more and more people using DLease, we're also occasionally running into unexpected bugs that we are not always able to fix ourselves.

The latest bug is that DLease doesn't report the correct available STEEM POWER available for delegation when the user is powering down. Currently, it overstates the available SP.

This info is displayed on your dashboard under Idle STEEM POWER.

If you want to help us solve this, there is a 200 BUILDTEAM Token + 200 STEEM bounty for the first good solution to this problem.

Please contact @thecryptodrive (thecryptodrive#8144) on Discord with your fix or your suggestion for a fix!

The current code to calculate idle STEEM POWER is:

let free = this.powerOwned - this.powerDelegated - this.poweringDown;
let effective = free + this.powerReceived;
let available = effective * this.votingPower;
if (available > free) {
     available = free;}
     return ((available * this.steemPerVest ).toFixed(3))

Thank you for your support!



Visit our website for more!
Subsribe to our YouTube Channel
Check out @Minnowbooster
Don't miss out on @Steemvoter
Set @buildteam as your Steem witness proxy

Set it up today and contribute to building a better tomorrow!

( Want an easier way? Use our SteemConnect proxy link! )

Join our Discord Chat

Get support and connect with us and other BuildTeam fans!




Disclaimer: This is a @steemvoter subscription payment post. Thank you to Steemvoter customers for allowing us to use your Steem accounts to upvote this post by virtue of your free subscription to the Steemvoter.com curation automation service. @steemvoter is proudly a @buildteam subsidiary and sister project to @dlease, @tokenbb, @ginabot, @steemsports. @steemsports-es and @minnowbooster.

Beneficiary Declaration: 10% @null burnpost + 10% @steem.dao

Remember to vote for your favourite Steem proposal at steemproposals.com!


Comments
Steemie currently dosen't allow you to make comments. If you want to write something, write it using another frontend (like Steemit)
Click there to view this post on Steemit.com
  • @smooth

    Downvoting because I think with #NewSteem it is even more clear than ever that using the reward pool to pay for Steemvoter subscriptions is not really appropriate (it was always controversial).

  • @therealwolf

    With HF20, the part of the Steempower that would be powered down is subtracted from the effective Steempower.

    I've added that logic to dsteem after the HF:

    https://github.com/jnordberg/dsteem/commit/12643644965f4605359545468d1f0787be92b953

    You can either write it yourself for effective vests:

    import {Asset} from 'dsteem'
    const vests = Asset.from(account.vesting_shares)
    const vests_delegated = Asset.from(account.delegated_vesting_shares)
    const vests_received = Asset.from(account.received_vesting_shares)
    const withdraw_rate = Asset.from(account.vesting_withdraw_rate)
    const already_withdrawn = (Number(account.to_withdraw) - Number(account.withdrawn)) / 1000000
    const withdraw_vests = Math.min(withdraw_rate.amount, already_withdrawn)
    vests = vests.subtract(withdraw_vests)
    vests = vests.subtract(vests_delegated)
    vests = vests.add(vests_received)
    return vests.amount
    

    Or use the already in-built function for that in dsteem:

    const client = new dsteem.Client('https://api.steemit.com')
    const account = await client.database.getAccounts(['therealwolf'])
    const vests = dsteem.getVests(account)
    

    https://github.com/jnordberg/dsteem/blob/master/src/steem/misc.ts#L247

  • @forykw

    Ok... this is my entry =)

    I Welcome some feedback @therealwolf

    Forgive me the standards and code "beauty" as I am not a dev guy and besides some advanced troubleshooting skills, I can only try to learn from many in terms of programming skills. Either way... this is my contribution.

    By the way... @steemchiller, you might want to look at this... as delegating with your tool, under some of these situations, will throw some "warnings" that I have "potentially" covered with this code. =)

    # -------------------------------------------------------------------------
    store.powerOwned = parseInt( result[ 0 ].vesting_shares.split( " " )[ 0 ] );
    store.powerDelegated = parseInt( result[ 0 ].delegated_vesting_shares.split( " " )[ 0 ] );
    store.powerReceived = parseInt( result[ 0 ].received_vesting_shares.split( " " )[ 0 ] );
    store.poweringDown = parseInt( (result[ 0 ].to_withdraw - result[ 0 ].withdrawn) / 1000000 )
    store.votingPower = result[ 0 ].voting_power / 10000;
    
    let free = this.powerOwned - this.powerDelegated - this.poweringDown;
    let effective = free + this.powerReceived;
    let available = 0;
    
    # locked = PowerReceivedLockedVestsRatio (1 - 0.00)
    # This is the absolut ratio of vests that can't be delegated (aka, percentage of VP locked)
    ###########################################################################
    let locked = 0;
    if (this.powerReceived > 0) {
        locked = (this.powerReceived / effective);}
    if (this.votingPower <= locked) {
        available = 0;
        return ((available * this.steemPerVest ).toFixed(3));
        }
        available = effective * (this.votingPower - locked);
        return ((available * this.steemPerVest ).toFixed(3))
    # -------------------------------------------------------------------------
    
  • @teenagecrypto

    I'm thinking of joining soon

  • @thecryptodrive

    I confirm that @forykw has solved this bounty and will be receiving the rewards on our distribution day on the 30th.