RE: RE: Help us fix a DLease Bug - 200 BUILDTEAM + 200 STEEM Bounty
You are viewing a single comment's thread from:

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

Words
45
Reading
1 min
7y

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

@therealwolf: With HF20, the | Ecency