Open alcueca opened 4 years ago
https://github.com/UptownResearch/pyTokenSpike/blob/a71909b85e484ff565554672b0dcaacb607c6b58/dapp/contracts/pytoken.sol#L264
I think that a require is missing: `require(repos[msg.sender].userCollateral >= amount, "withdrawCollateral/not-enough-collateral");
require
Alternatively, you can use SafeMath:
SafeMath
repos[msg.sender].userCollateral = repos[msg.sender].userCollateral.sub( amount, "withdrawCollateral/not-enough-collateral" );
SafeMath would be fine. I'm not super-familiar with it, but better math was of course the reason I reached out.
https://github.com/UptownResearch/pyTokenSpike/blob/a71909b85e484ff565554672b0dcaacb607c6b58/dapp/contracts/pytoken.sol#L264
I think that a
require
is missing: `require(repos[msg.sender].userCollateral >= amount, "withdrawCollateral/not-enough-collateral");Alternatively, you can use
SafeMath
: