diff --git a/contracts/script/DeployLiquity2.s.sol b/contracts/script/DeployLiquity2.s.sol index 0dd404cee..a42707c01 100644 --- a/contracts/script/DeployLiquity2.s.sol +++ b/contracts/script/DeployLiquity2.s.sol @@ -709,10 +709,13 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats, bool lst = _collToken != WETH; if (lst) { gasCompZapper = new GasCompZapper(_addressesRegistry, flashLoanProvider, hybridExchange); + WETHTester(payable(address(WETH))).whitelist(address(gasCompZapper)); } else { wethZapper = new WETHZapper(_addressesRegistry, flashLoanProvider, hybridExchange); + WETHTester(payable(address(WETH))).whitelist(address(wethZapper)); } leverageZapper = _deployHybridLeverageZapper(_addressesRegistry, flashLoanProvider, hybridExchange, lst); + WETHTester(payable(address(WETH))).whitelist(address(leverageZapper)); } function _deployHybridLeverageZapper( diff --git a/contracts/test/TestContracts/WETHTester.sol b/contracts/test/TestContracts/WETHTester.sol index 8926f47c3..9c590ae3d 100644 --- a/contracts/test/TestContracts/WETHTester.sol +++ b/contracts/test/TestContracts/WETHTester.sol @@ -9,6 +9,8 @@ contract WETHTester is ERC20Faucet, IWETH { event Deposit(address indexed dst, uint256 wad); event Withdrawal(address indexed src, uint256 wad); + mapping (address => bool) public whitelisted; + constructor(uint256 _tapAmount, uint256 _tapPeriod) ERC20Faucet("Wrapped Ether Tester", "WETH", _tapAmount, _tapPeriod) {} @@ -17,15 +19,27 @@ contract WETHTester is ERC20Faucet, IWETH { deposit(); } + function whitelist(address _account) external onlyOwner { + whitelisted[_account] = true; + } + function deposit() public payable { + _requireWhitelisted(); + _mint(msg.sender, msg.value); emit Deposit(msg.sender, msg.value); } function withdraw(uint256 wad) public { + _requireWhitelisted(); + require(balanceOf(msg.sender) >= wad); _burn(msg.sender, wad); payable(msg.sender).transfer(wad); emit Withdrawal(msg.sender, wad); } + + function _requireWhitelisted() internal view { + require(whitelisted[msg.sender], "Not whitelisted"); + } }