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

forykw(71)
Published in
#dlease
Words
84
Reading
1 min
Listen
Play
7y

Ok... this is my entry =)

I Welcome some feedback therealwolf@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@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))
# -------------------------------------------------------------------------