DemocracyEarth / ubi

Universal Basic Income token.
224 stars 39 forks source link

UBIv v2 fails to get delegator balance after delegated withdraws #102

Closed JuanuMusic closed 2 years ago

JuanuMusic commented 2 years ago

Steps to reproduce: user 1: 1) registers on POH 2) execute startAcrruing 3) Creates stream with parameters:

4) After some time, user 2 executes withdrawFromStream 5) try to get balance of UBI from user 1 Expected result: Should correctly fetch UBI balance for user 1 Actual result: Fails with the following error:

Error: VM Exception while processing transaction: revert SafeMath: subtraction overflow
      at UBI.sub (@openzeppelin/contracts/math/SafeMath.sol:102)
      at UBI.getDelegatedAccruedValue (contracts/UBI.sol:761)
      at UBI.balanceOf (contracts/UBI.sol:342)
JuanuMusic commented 2 years ago

PR has been merged