Set max if amount higher than max withdraw amount

This commit is contained in:
Thrilok Kumar 2020-08-31 12:54:45 +05:30
parent d43a1509ee
commit ee9e1b39d0
2 changed files with 2 additions and 4 deletions

View File

@ -169,11 +169,10 @@ contract PoolToken is ReentrancyGuard, DSMath, ERC20Pausable {
uint _bal = balanceOf(msg.sender);
uint _tknBal = wdiv(_bal, exchangeRate);
uint _burnAmt;
if (tknAmt == uint(-1)) {
if (tknAmt >= _tknBal) {
_burnAmt = _bal;
_tknAmt = _tknBal;
} else {
require(tknAmt <= _tknBal, "balance-exceeded");
_burnAmt = wmul(tknAmt, exchangeRate);
_tknAmt = tknAmt;
}

View File

@ -165,11 +165,10 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
uint _bal = balanceOf(msg.sender);
uint _tknBal = wdiv(_bal, exchangeRate);
uint _burnAmt;
if (tknAmt == uint(-1)) {
if (tknAmt >= _tknBal) {
_burnAmt = _bal;
_tknAmt = _tknBal;
} else {
require(tknAmt <= _tknBal, "balance-exceeded");
_burnAmt = wmul(tknAmt, exchangeRate);
_tknAmt = tknAmt;
}