SteemVBS Update: Vests/Steem Conversion and Current Vote Worth
Introducing to SteemVBS
SteemVBS is the first Steem Library written in VBScript. Yes, it is VBScript. ;)
New Features
Adding the support for Vests/Steem Conversions and the functions to get the current vote worth. In particular, the following functions have been added to the library.
' get account upvote value Public Function GetAccount_UpvoteValue(id, vp, weight) Dim power power = (100 * vp * 100 * weight / 1e4 + 49) / 50 Dim total_vests total_vests = GetAccountVests(id) Dim final_vests final_vests = total_vests * 1e6 Dim rshares rshares = power * final_vests / 1e4 Dim rewards rewards = GetRewardFund Dim sbd_median_price sbd_median_price = GetMedianPrice Dim estimate estimate = rshares / GetRecentClaims * rewards * sbd_median_price GetAccount_UpvoteValue = estimate End Function
Dim fund fund = SteemIt.GetRewardFund AssertTrue fund > 0, "Rewards Pool should be larger than zero"
Dim esp esp = SteemIt.Vests_To_Steem(SteemIt.GetAccountVests("justyy")) AssertTrue esp > 1000, "justyy's ESP should be at least 1000"
Dim price price = SteemIt.GetMedianPrice AssertTrue price > 0, "median price should be larger than 0"
Dim upvote_value upvote_value = SteemIt.GetAccount_UpvoteValue("justyy", 100, 100) AssertTrue upvote_value > 0.1, "full vote value should be at least $0.1"
Dim current_upvote_value current_upvote_value = SteemIt.GetAccount_UpvoteValue("justyy", 50, 20) AssertEqualFloat upvote_value * 0.5 * 0.2, current_upvote_value, 0.1, "current upvote value calculation error"