diff --git a/contracts/mainnet/connectors/pooltogether/interface.sol b/contracts/mainnet/connectors/pooltogether/interface.sol index 6ac71665..1780cc57 100644 --- a/contracts/mainnet/connectors/pooltogether/interface.sol +++ b/contracts/mainnet/connectors/pooltogether/interface.sol @@ -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); } \ No newline at end of file diff --git a/contracts/mainnet/connectors/pooltogether/main.sol b/contracts/mainnet/connectors/pooltogether/main.sol index aa5b1106..88e27fa4 100644 --- a/contracts/mainnet/connectors/pooltogether/main.sol +++ b/contracts/mainnet/connectors/pooltogether/main.sol @@ -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);