The vests_to_rshares function of the beem.steem module should return the number of rshares a vote by an account dependent on the vests and the voting power the account has, and the vote percentage that account uses for voting.
Instead, that function returns the rshares that it should return, but 1e6 times smaller. This issue happens because the vests would need to be multiplied with 1e6 in order to be in the right scope for the calculation (relevant tutorial) This would need to be added here.
How to reproduce
from beem.steem import Steem
- Get a Steem() instance. (e.g.
stm = Steem())
- Run the vests_to_rshares function on any number of vests. (e.g.
- Transform the value point 2. returned to SBD using the rshares_to_sbd function. (e.g.
- Run the vests_to_sbd function on the same number of vests as before. (e.g.
- Compare the two values you got in point 3. and 4., and see that the one you got in point 3 is 1e6 times smaller than the other one.
It looks like this in a REPL:
>>> from beem.steem import Steem >>> stm = Steem() >>> stm.vests_to_rshares(10000000) 200000
^This is where the issue is. That should be 200000000000 instead
>>> stm.rshares_to_sbd(200000) 3.3005542087518333e-07 >>> stm.vests_to_sbd(10000000) 0.33005542087518336
After applying a fix, it would look like that:
>>> from beem.steem import Steem >>> stm = Steem() >>> stm.vests_to_rshares(10000000) 200000000000 >>> stm.rshares_to_sbd(200000000000) 0.33005542087518336 >>> stm.vests_to_sbd(10000000) 0.33005542087518336
- beem version: 0.19.52
- Operating system: Windows 10