Fix: Add condition for uint256(-1) case.

This commit is contained in:
eccheung4 2021-09-02 13:29:55 -07:00
parent f9762d8dfc
commit 09aa2913e7
2 changed files with 7 additions and 0 deletions

View File

@ -17,4 +17,5 @@ interface TokenFaucetProxyFactoryInterface {
interface PodInterface {
function depositTo(address to, uint256 tokenAmount) external returns (uint256);
function withdraw(uint256 shareAmount, uint256 maxFee) external returns (uint256);
function balanceOf(address account) external view returns (uint256);
}

View File

@ -43,6 +43,7 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic {
// Approve prizePool
TokenInterface tokenContract = TokenInterface(prizePoolToken);
_amount = _amount == uint256(-1) ? tokenContract.balanceOf(address(this)) : _amount;
tokenContract.approve(prizePool, _amount);
prizePoolContract.depositTo(address(this), _amount, controlledToken, referrer);
@ -76,6 +77,9 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic {
PrizePoolInterface prizePoolContract = PrizePoolInterface(prizePool);
TokenInterface ticketToken = TokenInterface(controlledToken);
_amount = _amount == uint256(-1) ? ticketToken.balanceOf(address(this)) : _amount;
prizePoolContract.withdrawInstantlyFrom(address(this), _amount, controlledToken, maximumExitFee);
setUint(setId, _amount);
@ -147,6 +151,7 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic {
// Approve pod
TokenInterface tokenContract = TokenInterface(prizePoolToken);
_tokenAmount = _tokenAmount == uint256(-1) ? tokenContract.balanceOf(address(this)) : _tokenAmount;
tokenContract.approve(pod, _tokenAmount);
podContract.depositTo(address(this), _tokenAmount);
@ -178,6 +183,7 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic {
uint _shareAmount = getUint(getId, shareAmount);
PodInterface podContract = PodInterface(pod);
_shareAmount = _shareAmount == uint256(-1) ? podContract.balanceOf(address(this)) : _shareAmount;
podContract.withdraw(_shareAmount, maxFee);