From 0518a123fe8249183824d52f5f9e4038d247c48c Mon Sep 17 00:00:00 2001 From: eccheung4 Date: Thu, 2 Sep 2021 22:57:08 -0700 Subject: [PATCH] Fix: use token address instead of prizePool address in depositToPod() --- contracts/mainnet/connectors/pooltogether/events.sol | 2 +- contracts/mainnet/connectors/pooltogether/main.sol | 9 +++------ test/pooltogether/pooltogether.test.js | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/contracts/mainnet/connectors/pooltogether/events.sol b/contracts/mainnet/connectors/pooltogether/events.sol index a73d9658..4c6c905e 100644 --- a/contracts/mainnet/connectors/pooltogether/events.sol +++ b/contracts/mainnet/connectors/pooltogether/events.sol @@ -7,6 +7,6 @@ contract Events { event LogWithdrawInstantlyFrom(address prizePool, address from, uint256 amount, address controlledToken, uint256 maximumExitFee, uint256 getId, uint256 setId); event LogClaim(address tokenFaucet, address user, uint256 claimed, uint256 setId); event LogClaimAll(address tokenFaucetProxyFactory, address user, TokenFaucetInterface[] tokenFaucets); - event LogDepositToPod(address prizePool, address pod, address to, uint256 amount, uint256 getId, uint256 setId); + event LogDepositToPod(address prizePoolToken, address pod, address to, uint256 amount, uint256 getId, uint256 setId); event LogWithdrawFromPod(address pod, uint256 shareAmount, uint256 maxFee, uint256 getId, uint256 setId); } \ No newline at end of file diff --git a/contracts/mainnet/connectors/pooltogether/main.sol b/contracts/mainnet/connectors/pooltogether/main.sol index 8bd73f0b..1e910bb5 100644 --- a/contracts/mainnet/connectors/pooltogether/main.sol +++ b/contracts/mainnet/connectors/pooltogether/main.sol @@ -127,14 +127,14 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic { /** * @dev Deposit into Pod * @notice Deposit assets into the Pod in exchange for share tokens - * @param prizePool PrizePool address to deposit to + * @param prizePoolToken Prize Pool Token Address * @param pod Pod address to deposit to * @param tokenAmount The amount of tokens to deposit. These are the same tokens used to deposit into the underlying prize pool. * @param getId Get token amount at this ID from `InstaMemory` Contract. * @param setId Set token amount at this ID in `InstaMemory` Contract. */ function depositToPod( - address prizePool, + address prizePoolToken, address pod, uint256 tokenAmount, uint256 getId, @@ -142,9 +142,6 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic { ) external payable returns ( string memory _eventName, bytes memory _eventParam) { uint _tokenAmount= getUint(getId, tokenAmount); - PrizePoolInterface prizePoolContract = PrizePoolInterface(prizePool); - address prizePoolToken = prizePoolContract.token(); - PodInterface podContract = PodInterface(pod); // Approve pod @@ -157,7 +154,7 @@ abstract contract PoolTogetherResolver is Events, DSMath, Basic { setUint(setId, _tokenAmount); _eventName = "LogDepositToPod(address,address,address,uint256,uint256, uint256)"; - _eventParam = abi.encode(address(prizePool), address(pod), address(this), _tokenAmount, getId, setId); + _eventParam = abi.encode(address(prizePoolToken), address(pod), address(this), _tokenAmount, getId, setId); } /** diff --git a/test/pooltogether/pooltogether.test.js b/test/pooltogether/pooltogether.test.js index 3656a630..d50ace47 100644 --- a/test/pooltogether/pooltogether.test.js +++ b/test/pooltogether/pooltogether.test.js @@ -344,7 +344,7 @@ describe("PoolTogether", function () { { connector: ptConnectorName, method: "depositToPod", - args: [DAI_PRIZE_POOL_ADDR, DAI_POD_ADDR, amount, 0, 0] + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] } ] @@ -433,7 +433,7 @@ describe("PoolTogether", function () { { connector: ptConnectorName, method: "depositToPod", - args: [DAI_PRIZE_POOL_ADDR, DAI_POD_ADDR, amount, 0, 0] + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] }, { connector: ptConnectorName,