From df780b55a0041de2965d39f8a862b0b6469eb50a Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Wed, 7 Oct 2020 20:44:23 +0530 Subject: [PATCH] Added nonReentrant guard to deposit() in token pool --- contracts/pools/erc20.sol | 2 +- contracts/pools/eth.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/pools/erc20.sol b/contracts/pools/erc20.sol index 49900d1..e813ed7 100644 --- a/contracts/pools/erc20.sol +++ b/contracts/pools/erc20.sol @@ -118,7 +118,7 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath { * @param tknAmt token amount * @return mintAmt amount of wrap token minted */ - function deposit(uint tknAmt) external payable whenNotPaused returns (uint mintAmt) { + function deposit(uint tknAmt) external payable nonReentrant whenNotPaused returns (uint mintAmt) { require(msg.value == 0, "non-eth-pool"); uint _tokenBal = wdiv(totalSupply(), exchangeRate); uint _newTknBal = add(_tokenBal, tknAmt); diff --git a/contracts/pools/eth.sol b/contracts/pools/eth.sol index 71a3fdb..143a69a 100644 --- a/contracts/pools/eth.sol +++ b/contracts/pools/eth.sol @@ -115,7 +115,7 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { * @param tknAmt token amount * @return mintAmt amount of wrap token minted */ - function deposit(uint tknAmt) external whenNotPaused payable returns (uint mintAmt) { + function deposit(uint tknAmt) external nonReentrant whenNotPaused payable returns (uint mintAmt) { require(tknAmt == msg.value, "unmatched-amount"); uint _tokenBal = wdiv(totalSupply(), exchangeRate); uint _newTknBal = add(_tokenBal, tknAmt);