Fixed how allowance crowdsale checks remaining tokens. (#1449)
(cherry picked from commit 1ac1ac984e)
This commit is contained in:
committed by
Leo Arias
parent
984fe23a46
commit
47b5d61844
@ -4,6 +4,7 @@ import "../Crowdsale.sol";
|
||||
import "../../token/ERC20/IERC20.sol";
|
||||
import "../../token/ERC20/SafeERC20.sol";
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../../math/Math.sol";
|
||||
|
||||
/**
|
||||
* @title AllowanceCrowdsale
|
||||
@ -36,7 +37,10 @@ contract AllowanceCrowdsale is Crowdsale {
|
||||
* @return Amount of tokens left in the allowance
|
||||
*/
|
||||
function remainingTokens() public view returns (uint256) {
|
||||
return token().allowance(_tokenWallet, this);
|
||||
return Math.min(
|
||||
token().balanceOf(_tokenWallet),
|
||||
token().allowance(_tokenWallet, this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user