From 90be975f1e666ef3501115ab8d6c1724bf1e6fc8 Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Mon, 27 Feb 2023 12:38:54 +0100 Subject: [PATCH 1/4] migrate infura to alchemy in hardhat package --- .gitignore | 2 +- packages/hardhat/.env.example | 12 +++++ packages/hardhat/README.md | 2 +- packages/hardhat/ci/e2e.sh | 6 +-- packages/hardhat/env.example | 9 ---- packages/hardhat/hardhat.config.ts | 50 +++---------------- .../hardhat/scripts/start_hardhat_fork.sh | 8 +-- 7 files changed, 28 insertions(+), 61 deletions(-) create mode 100644 packages/hardhat/.env.example delete mode 100644 packages/hardhat/env.example diff --git a/.gitignore b/.gitignore index e3520f322..ac1ed8b14 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,7 @@ build .DS_Store .env -packages/hardhat/.env* +packages/hardhat/.env # debug npm-debug.log* diff --git a/packages/hardhat/.env.example b/packages/hardhat/.env.example new file mode 100644 index 000000000..626f30381 --- /dev/null +++ b/packages/hardhat/.env.example @@ -0,0 +1,12 @@ +# Supply an ALCHEMY_KEY to deploy and run scripts +ALCHEMY_KEY= + +# For hardhat fork +FORK_RPC_ENDPOINT=https://alchemy/key + +# Unit test gas report +COINMARKETCAP= +REPORT_GAS= + +# For contract verification +ETHERSCAN_KEY= \ No newline at end of file diff --git a/packages/hardhat/README.md b/packages/hardhat/README.md index 2b101f53f..47876b4aa 100644 --- a/packages/hardhat/README.md +++ b/packages/hardhat/README.md @@ -62,7 +62,7 @@ yarn chain yarn deploy ``` -to deploying on testnet, with INFURA_KEY specified as environment variable +to deploying on testnet, with ALCHEMY_KEY specified as environment variable ```shell npx hardhat deploy --network ropsten diff --git a/packages/hardhat/ci/e2e.sh b/packages/hardhat/ci/e2e.sh index 01d5ed0da..44cc5d2f6 100755 --- a/packages/hardhat/ci/e2e.sh +++ b/packages/hardhat/ci/e2e.sh @@ -1,8 +1,8 @@ #!/bin/bash -# TO RUN: execute in packages/hardhat dir: INFURA_KEY=key ./ci/e2e.sh +# TO RUN: execute in packages/hardhat dir: ALCHEMY_KEY=key ./ci/e2e.sh echo "Starting E2E mainnet fork tests" -echo "Using the current Infura key: " $INFURA_KEY +echo "Using the current Alchemy key: " $ALCHEMY_KEY -$(npm bin)/hardhat node --fork https://mainnet.infura.io/v3/$INFURA_KEY --fork-block-number 14345140 --no-deploy --network hardhat > /dev/null 2>&1 & sleep 10 && MAINNET_FORK=true $(npm bin)/hardhat test ./test/e2e/**.ts \ No newline at end of file +$(npm bin)/hardhat node --fork https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_KEY --fork-block-number 14345140 --no-deploy --network hardhat > /dev/null 2>&1 & sleep 10 && MAINNET_FORK=true $(npm bin)/hardhat test ./test/e2e/**.ts \ No newline at end of file diff --git a/packages/hardhat/env.example b/packages/hardhat/env.example deleted file mode 100644 index c090f7c61..000000000 --- a/packages/hardhat/env.example +++ /dev/null @@ -1,9 +0,0 @@ -# Supply an INFURA_KEY to deploy and run scripts -INFURA_KEY= - -# Unit test gas report -COINMARKETCAP= -REPORT_GAS= - -# For contract verification -ETHERSCAN_KEY= \ No newline at end of file diff --git a/packages/hardhat/hardhat.config.ts b/packages/hardhat/hardhat.config.ts index 051bb3211..bc99982e6 100644 --- a/packages/hardhat/hardhat.config.ts +++ b/packages/hardhat/hardhat.config.ts @@ -24,18 +24,9 @@ import './tasks/increaseSlot' // Load env variables dotenv.config() -const InfuraKey = process.env.INFURA_KEY +const alchemyKey = process.env.ALCHEMY_KEY const fs = require("fs"); -/* - 📡 This is where you configure your deploy configuration for 🏗 scaffold-eth - - check out `packages/scripts/deploy.js` to customize your deployment - - out of the box it will auto deploy anything in the `contracts` folder and named *.sol - plus it will use *.args for constructor args -*/ - // // Select the network you want to deploy to here: // @@ -91,44 +82,26 @@ const config: HardhatUserConfig = { (you can put in a mnemonic here to set the deployer locally) */ }, - rinkeby: { - url: `https://rinkeby.infura.io/v3/${InfuraKey}`, // <---- YOUR INFURA ID! (or it won't work) - accounts, - }, goerli: { - url: `https://goerli.infura.io/v3/${InfuraKey}`, // <---- YOUR INFURA ID! (or it won't work) - accounts, - }, - kovan: { - url: `https://kovan.infura.io/v3/${InfuraKey}`, // <---- YOUR INFURA ID! (or it won't work) + url: `https://eth-goerli.g.alchemy.com/v2/${alchemyKey}`, accounts, }, mainnet: { - url: `https://mainnet.infura.io/v3/${InfuraKey}`, // <---- YOUR INFURA ID! (or it won't work) - accounts, - }, - ropsten: { - url: `https://ropsten.infura.io/v3/${InfuraKey}`, // <---- YOUR INFURA ID! (or it won't work) - accounts, - gas: 8000000000000000 - }, - xdai: { - url: "https://rpc.xdaichain.com/", - gasPrice: 1000000000, + url: `https://eth-mainnet.g.alchemy.com/v2/${alchemyKey}`, accounts, }, matic: { - url: "https://rpc-mainnet.maticvigil.com/", + url: "https://polygon-mainnet.g.alchemy.com/v2/", gasPrice: 1000000000, accounts, }, - rinkebyArbitrum: { - url: "https://rinkeby.arbitrum.io/rpc", + goerliArbitrum: { + url: `https://arb-goerli.g.alchemy.com/v2/${alchemyKey}`, gasPrice: 30000000, // 0.03 gwei gas: 30_000_000, accounts, companionNetworks: { - l1: "rinkeby", + l1: "goerli", }, }, localArbitrum: { @@ -147,15 +120,6 @@ const config: HardhatUserConfig = { l2: "localArbitrum", }, }, - kovanOptimism: { - url: "https://kovan.optimism.io", - gasPrice: 0, - accounts, - ovm: true, - companionNetworks: { - l1: "kovan", - }, - }, localOptimism: { url: "http://localhost:8545", gasPrice: 0, diff --git a/packages/hardhat/scripts/start_hardhat_fork.sh b/packages/hardhat/scripts/start_hardhat_fork.sh index 588603eeb..e64f64cf1 100755 --- a/packages/hardhat/scripts/start_hardhat_fork.sh +++ b/packages/hardhat/scripts/start_hardhat_fork.sh @@ -1,11 +1,11 @@ # HOW TO USE: -# Run the following shell script using: INFURA_KEY=ur_keeeeey ./start_hardhat_fork.sh +# Run the following shell script using: ALCHEMY_KEY=ur_keeeeey ./start_hardhat_fork.sh # To stop hardhat fork, run ./stop_hardhat_fork.sh #!/bin/bash -infuraKey=$INFURA_KEY +alchemyKey=$ALCHEMY_KEY -echo "Using the current infura key: ${infuraKey}" +echo "Using the current infura key: ${alchemyKey}" -$(npm bin)/hardhat node --no-deploy --network hardhat --fork https://mainnet.infura.io/v3/$infuraKey \ No newline at end of file +$(npm bin)/hardhat node --no-deploy --network hardhat --fork https://eth-mainnet.g.alchemy.com/v2/$alchemyKey \ No newline at end of file From 35973584adaae401cd37e3543deb57f0d5af9fdd Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Mon, 27 Feb 2023 13:31:38 +0100 Subject: [PATCH 2/4] lint --- packages/zen-bull-netting/src/FlashSwap.sol | 2 +- packages/zen-bull-netting/src/NettingLib.sol | 6 +- .../zen-bull-netting/src/ZenBullNetting.sol | 16 +-- .../test/ZenBullNettingBaseSetup.t.sol | 2 +- .../DepositAuctionFuzzing.t.sol | 4 +- .../ZenBullNetting/DepositAuction.t.sol | 4 +- .../test/unit-test/QueueEth.t.sol | 4 +- packages/zen-bull-vault/src/FlashZen.sol | 10 +- packages/zen-bull-vault/src/LeverageZen.sol | 2 +- packages/zen-bull-vault/src/ZenAuction.sol | 6 +- .../zen-bull-vault/src/ZenBullStrategy.sol | 8 +- .../test/fuzz-test/FlashZenFuzzTest.t.sol | 2 +- .../test/fuzz-test/LeverageZenFuzzTest.t.sol | 8 +- .../test/fuzz-test/ZenAuctionFuzzTest.t.sol | 10 +- .../fuzz-test/ZenBullStrategyFuzzTest.t.sol | 4 +- .../integration-test/FlashZenTestFork.t.sol | 14 +-- .../integration-test/ZenAuctionTestFork.t.sol | 98 +++++++++---------- .../ZenBullStrategyTestFork.t.sol | 16 +-- .../ZenEmergencyShutdownTestFork.t.sol | 2 +- .../test/unit-test/ZenBullStrategyTest.t.sol | 8 +- 20 files changed, 113 insertions(+), 113 deletions(-) diff --git a/packages/zen-bull-netting/src/FlashSwap.sol b/packages/zen-bull-netting/src/FlashSwap.sol index 0cc27449b..a510ea30b 100644 --- a/packages/zen-bull-netting/src/FlashSwap.sol +++ b/packages/zen-bull-netting/src/FlashSwap.sol @@ -32,7 +32,7 @@ library PoolAddress { returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); - return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); + return PoolKey({ token0: tokenA, token1: tokenB, fee: fee }); } /// @notice Deterministically computes the pool address given the factory and PoolKey diff --git a/packages/zen-bull-netting/src/NettingLib.sol b/packages/zen-bull-netting/src/NettingLib.sol index cb6934002..84ed16f8c 100644 --- a/packages/zen-bull-netting/src/NettingLib.sol +++ b/packages/zen-bull-netting/src/NettingLib.sol @@ -54,7 +54,7 @@ library NettingLib { emit TransferWethFromMarketMakers( _trader, _oSqthToMint, wethAmount, remainingOsqthToMint, _clearingPrice - ); + ); return (true, remainingOsqthToMint); } else { wethAmount = (_quantity * _clearingPrice) / 1e18; @@ -63,7 +63,7 @@ library NettingLib { emit TransferWethFromMarketMakers( _trader, _quantity, wethAmount, remainingOsqthToMint, _clearingPrice - ); + ); return (false, remainingOsqthToMint); } } @@ -164,7 +164,7 @@ library NettingLib { emit TransferWethToMarketMaker( _trader, _bidId, _quantity, wethAmount, _remainingOsqthToPull, _clearingPrice - ); + ); return _remainingOsqthToPull; } diff --git a/packages/zen-bull-netting/src/ZenBullNetting.sol b/packages/zen-bull-netting/src/ZenBullNetting.sol index 55486d071..44fc1f948 100644 --- a/packages/zen-bull-netting/src/ZenBullNetting.sol +++ b/packages/zen-bull-netting/src/ZenBullNetting.sol @@ -616,7 +616,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { uint256 wethFromAuction = IWETH(weth).balanceOf(address(this)); IWETH(weth).withdraw(wethFromAuction); - ICrabStrategyV2(crab).deposit{value: ethIntoCrab}(); + ICrabStrategyV2(crab).deposit{ value: ethIntoCrab }(); (uint256 wethToLend, uint256 usdcToBorrow) = NettingLib.calcWethToLendAndUsdcToBorrow( eulerLens, zenBull, weth, usdc, IERC20(crab).balanceOf(address(this)) @@ -650,7 +650,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { usdcPoolFee: _params.wethUsdcPoolFee }); - IFlashZen(flashZenBull).flashDeposit{value: memVar.remainingEth}(params); + IFlashZen(flashZenBull).flashDeposit{ value: memVar.remainingEth }(params); } } @@ -708,7 +708,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { zenBullAmountToSend, k, ethAmountToSend - ); + ); } else { ethBalance[depositReceipt.sender] -= memVar.remainingDeposits; @@ -731,7 +731,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { zenBullAmountToSend, k, ethAmountToSend - ); + ); break; } } @@ -745,7 +745,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { _params.clearingPrice, memVar.oSqthBalance, k - ); + ); } /** @@ -790,7 +790,7 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { ); // send WETH to market makers - IWETH(weth).deposit{value: address(this).balance - initialEthBalance}(); + IWETH(weth).deposit{ value: address(this).balance - initialEthBalance }(); toExchange = oSqthAmount; for (uint256 i = 0; i < _params.orders.length && toExchange > 0; i++) { toExchange = NettingLib.transferWethToMarketMaker( @@ -865,13 +865,13 @@ contract ZenBullNetting is Ownable, EIP712, FlashSwap { uint256 zenBullAmountToBurn = abi.decode(callData, (uint256)); IZenBullStrategy(zenBull).withdraw(zenBullAmountToBurn); - IWETH(weth).deposit{value: amountToPay}(); + IWETH(weth).deposit{ value: amountToPay }(); IWETH(weth).transfer(pool, amountToPay); } else if (callSource == 1) { uint256 wethToLend = abi.decode(callData, (uint256)); IWETH(weth).withdraw(IWETH(weth).balanceOf(address(this))); - IZenBullStrategy(zenBull).deposit{value: wethToLend}( + IZenBullStrategy(zenBull).deposit{ value: wethToLend }( IERC20(crab).balanceOf(address(this)) ); IERC20(usdc).transfer(pool, amountToPay); diff --git a/packages/zen-bull-netting/test/ZenBullNettingBaseSetup.t.sol b/packages/zen-bull-netting/test/ZenBullNettingBaseSetup.t.sol index 351941747..cc3686889 100644 --- a/packages/zen-bull-netting/test/ZenBullNettingBaseSetup.t.sol +++ b/packages/zen-bull-netting/test/ZenBullNettingBaseSetup.t.sol @@ -82,7 +82,7 @@ contract ZenBullNettingBaseSetup is Test { function _queueEth(address _user, uint256 _amount) internal { vm.startPrank(_user); - zenBullNetting.queueEth{value: _amount}(); + zenBullNetting.queueEth{ value: _amount }(); vm.stopPrank(); } diff --git a/packages/zen-bull-netting/test/fuzzing/ZenBullNetting/DepositAuctionFuzzing.t.sol b/packages/zen-bull-netting/test/fuzzing/ZenBullNetting/DepositAuctionFuzzing.t.sol index 3df14b95a..9e4c90b4e 100644 --- a/packages/zen-bull-netting/test/fuzzing/ZenBullNetting/DepositAuctionFuzzing.t.sol +++ b/packages/zen-bull-netting/test/fuzzing/ZenBullNetting/DepositAuctionFuzzing.t.sol @@ -47,9 +47,9 @@ contract DepositAuctionFuzzing is ZenBullNettingBaseSetup { vm.deal(mm2, 5000e18); vm.prank(mm1); - IWETH(WETH).deposit{value: 5000e18}(); + IWETH(WETH).deposit{ value: 5000e18 }(); vm.prank(mm2); - IWETH(WETH).deposit{value: 5000e18}(); + IWETH(WETH).deposit{ value: 5000e18 }(); // update ZenBull cap to 100000 ETH vm.store(ZEN_BULL, bytes32(uint256(9)), bytes32(uint256(100000e18))); diff --git a/packages/zen-bull-netting/test/integration-test/ZenBullNetting/DepositAuction.t.sol b/packages/zen-bull-netting/test/integration-test/ZenBullNetting/DepositAuction.t.sol index ab45f7b49..3e9d8c811 100644 --- a/packages/zen-bull-netting/test/integration-test/ZenBullNetting/DepositAuction.t.sol +++ b/packages/zen-bull-netting/test/integration-test/ZenBullNetting/DepositAuction.t.sol @@ -47,9 +47,9 @@ contract DepositAuction is ZenBullNettingBaseSetup { vm.deal(mm2, 5000e18); vm.prank(mm1); - IWETH(WETH).deposit{value: 1000e18}(); + IWETH(WETH).deposit{ value: 1000e18 }(); vm.prank(mm2); - IWETH(WETH).deposit{value: 1000e18}(); + IWETH(WETH).deposit{ value: 1000e18 }(); } function _calAuctionCrabAmount(uint256 _depositToProcess) internal view returns (uint256) { diff --git a/packages/zen-bull-netting/test/unit-test/QueueEth.t.sol b/packages/zen-bull-netting/test/unit-test/QueueEth.t.sol index 2b2cc70c5..f64698f27 100644 --- a/packages/zen-bull-netting/test/unit-test/QueueEth.t.sol +++ b/packages/zen-bull-netting/test/unit-test/QueueEth.t.sol @@ -52,7 +52,7 @@ contract QueueEth is ZenBullNettingBaseSetup { // _queueEth(user1, amount); vm.prank(user1); - (bool success,) = address(zenBullNetting).call{value: amount}(""); + (bool success,) = address(zenBullNetting).call{ value: amount }(""); assertTrue(success); assertEq(zenBullNetting.ethBalance(user1), amount); @@ -69,7 +69,7 @@ contract QueueEth is ZenBullNettingBaseSetup { vm.startPrank(user1); vm.expectRevert(bytes("ZBN03")); - zenBullNetting.queueEth{value: amount}(); + zenBullNetting.queueEth{ value: amount }(); vm.stopPrank(); } } diff --git a/packages/zen-bull-vault/src/FlashZen.sol b/packages/zen-bull-vault/src/FlashZen.sol index 838465c39..d6504bdc4 100644 --- a/packages/zen-bull-vault/src/FlashZen.sol +++ b/packages/zen-bull-vault/src/FlashZen.sol @@ -215,7 +215,7 @@ contract FlashZen is UniFlash { emit FlashDeposit( msg.sender, crabAmount, msg.value, wPowerPerpToMint, usdcToBorrow, wethToLend - ); + ); } /** @@ -276,7 +276,7 @@ contract FlashZen is UniFlash { // convert WETH to ETH as Uniswap uses WETH IWETH9(weth).withdraw(IWETH9(weth).balanceOf(address(this))); - ICrabStrategyV2(crab).deposit{value: data.ethToDepositInCrab}(); + ICrabStrategyV2(crab).deposit{ value: data.ethToDepositInCrab }(); // repay the wPowerPerp flash swap IERC20(wPowerPerp).transfer(_uniFlashSwapData.pool, _uniFlashSwapData.amountToPay); @@ -288,7 +288,7 @@ contract FlashZen is UniFlash { abi.decode(_uniFlashSwapData.callData, (FlashDepositCollateralData)); IWETH9(weth).withdraw(IWETH9(weth).balanceOf(address(this))); - IZenBullStrategy(bullStrategy).deposit{value: data.wethToLend}(data.crabToDeposit); + IZenBullStrategy(bullStrategy).deposit{ value: data.wethToLend }(data.crabToDeposit); // repay the dollars flash swap IERC20(usdc).transfer(_uniFlashSwapData.pool, _uniFlashSwapData.amountToPay); @@ -308,7 +308,7 @@ contract FlashZen is UniFlash { abi.encodePacked(data.bullToRedeem, data.usdcToRepay) ); - IWETH9(weth).deposit{value: _uniFlashSwapData.amountToPay}(); + IWETH9(weth).deposit{ value: _uniFlashSwapData.amountToPay }(); IERC20(weth).transfer(_uniFlashSwapData.pool, _uniFlashSwapData.amountToPay); } else if (FLASH_SOURCE(_uniFlashSwapData.callSource) == FLASH_SOURCE.FLASH_WITHDRAW_BULL) { FlashWithdrawBullData memory data = @@ -316,7 +316,7 @@ contract FlashZen is UniFlash { IZenBullStrategy(bullStrategy).withdraw(data.bullToRedeem); - IWETH9(weth).deposit{value: _uniFlashSwapData.amountToPay}(); + IWETH9(weth).deposit{ value: _uniFlashSwapData.amountToPay }(); IERC20(weth).transfer(_uniFlashSwapData.pool, _uniFlashSwapData.amountToPay); } } diff --git a/packages/zen-bull-vault/src/LeverageZen.sol b/packages/zen-bull-vault/src/LeverageZen.sol index dd3a333fd..232dfefa9 100644 --- a/packages/zen-bull-vault/src/LeverageZen.sol +++ b/packages/zen-bull-vault/src/LeverageZen.sol @@ -241,7 +241,7 @@ contract LeverageZen is Ownable { * @param _ethToDeposit amount of ETH to deposit */ function _depositWethInEuler(uint256 _ethToDeposit) internal { - IWETH9(weth).deposit{value: _ethToDeposit}(); + IWETH9(weth).deposit{ value: _ethToDeposit }(); IEulerEToken(eToken).deposit(0, _ethToDeposit); } diff --git a/packages/zen-bull-vault/src/ZenAuction.sol b/packages/zen-bull-vault/src/ZenAuction.sol index 994b68d76..f66f22008 100644 --- a/packages/zen-bull-vault/src/ZenAuction.sol +++ b/packages/zen-bull-vault/src/ZenAuction.sol @@ -251,7 +251,7 @@ contract ZenAuction is UniFlash, Ownable, EIP712 { emit SetFullRebalanceClearingPriceTolerance( fullRebalanceClearingPriceTolerance, _fullRebalancePriceTolerance - ); + ); fullRebalanceClearingPriceTolerance = _fullRebalancePriceTolerance; } @@ -271,7 +271,7 @@ contract ZenAuction is UniFlash, Ownable, EIP712 { emit SetRebalanceWethLimitPriceTolerance( rebalanceWethLimitPriceTolerance, _rebalanceWethLimitPriceTolerance - ); + ); rebalanceWethLimitPriceTolerance = _rebalanceWethLimitPriceTolerance; } @@ -401,7 +401,7 @@ contract ZenAuction is UniFlash, Ownable, EIP712 { emit FullRebalance( _crabAmount, _clearingPrice, _isDepositingInCrab, wPowerPerpAmount, _wethTargetInEuler - ); + ); } /** diff --git a/packages/zen-bull-vault/src/ZenBullStrategy.sol b/packages/zen-bull-vault/src/ZenBullStrategy.sol index ab850d590..43c0d0bc0 100644 --- a/packages/zen-bull-vault/src/ZenBullStrategy.sol +++ b/packages/zen-bull-vault/src/ZenBullStrategy.sol @@ -213,7 +213,7 @@ contract ZenBullStrategy is ERC20, LeverageZen { wPowerPerpToRedeem, usdcToRepay, address(this).balance - ); + ); payable(msg.sender).sendValue(address(this).balance); } @@ -238,7 +238,7 @@ contract ZenBullStrategy is ERC20, LeverageZen { _decreaseCrabBalance(crabBalancebefore.sub(IERC20(crab).balanceOf(address(this)))); uint256 wethBalanceToReturn = address(this).balance; - IWETH9(weth).deposit{value: wethBalanceToReturn}(); + IWETH9(weth).deposit{ value: wethBalanceToReturn }(); IWETH9(weth).transfer(msg.sender, wethBalanceToReturn); emit RedeemCrabAndWithdrawEth(_crabToRedeem, _wPowerPerpToRedeem, wethBalanceToReturn); @@ -258,7 +258,7 @@ contract ZenBullStrategy is ERC20, LeverageZen { uint256 crabBalancebefore = IERC20(crab).balanceOf(address(this)); - ICrabStrategyV2(crab).deposit{value: _ethToDeposit}(); + ICrabStrategyV2(crab).deposit{ value: _ethToDeposit }(); _increaseCrabBalance(IERC20(crab).balanceOf(address(this)).sub(crabBalancebefore)); @@ -283,7 +283,7 @@ contract ZenBullStrategy is ERC20, LeverageZen { ICrabStrategyV2(crab).withdrawShutdown(crabToRedeem); _repayAndWithdrawFromLeverage(shareToUnwind); - IWETH9(weth).deposit{value: wethToUniswap}(); + IWETH9(weth).deposit{ value: wethToUniswap }(); IWETH9(weth).transfer(shutdownContract, wethToUniswap); emit ShutdownRepayAndWithdraw(wethToUniswap, shareToUnwind, crabToRedeem); diff --git a/packages/zen-bull-vault/test/fuzz-test/FlashZenFuzzTest.t.sol b/packages/zen-bull-vault/test/fuzz-test/FlashZenFuzzTest.t.sol index 71cfe8eba..19ab3404d 100644 --- a/packages/zen-bull-vault/test/fuzz-test/FlashZenFuzzTest.t.sol +++ b/packages/zen-bull-vault/test/fuzz-test/FlashZenFuzzTest.t.sol @@ -319,7 +319,7 @@ contract FlashZenFuzzTest is Test { testUtil.calcCollateralAndBorrowAmount(_crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), _crabToDeposit); - bullStrategy.deposit{value: wethToLend}(_crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(_crabToDeposit); return (wethToLend, usdcToBorrow); } diff --git a/packages/zen-bull-vault/test/fuzz-test/LeverageZenFuzzTest.t.sol b/packages/zen-bull-vault/test/fuzz-test/LeverageZenFuzzTest.t.sol index 57c0380c5..78889aa26 100644 --- a/packages/zen-bull-vault/test/fuzz-test/LeverageZenFuzzTest.t.sol +++ b/packages/zen-bull-vault/test/fuzz-test/LeverageZenFuzzTest.t.sol @@ -91,7 +91,7 @@ contract LeverageZenFuzzTest is Test { vm.startPrank(auction); // deposit first WETH in euler - IWETH9(weth).deposit{value: _wethToDeposit}(); + IWETH9(weth).deposit{ value: _wethToDeposit }(); IWETH9(weth).approve(address(leverageBull), _wethToDeposit); leverageBull.depositAndBorrowFromLeverage(_wethToDeposit, 0); vm.stopPrank(); @@ -127,7 +127,7 @@ contract LeverageZenFuzzTest is Test { vm.startPrank(auction); // deposit first WETH in euler - IWETH9(weth).deposit{value: _wethToDeposit}(); + IWETH9(weth).deposit{ value: _wethToDeposit }(); IWETH9(weth).approve(address(leverageBull), _wethToDeposit); leverageBull.depositAndBorrowFromLeverage(_wethToDeposit, 0); vm.stopPrank(); @@ -158,7 +158,7 @@ contract LeverageZenFuzzTest is Test { vm.startPrank(auction); // deposit first WETH in euler - IWETH9(weth).deposit{value: _wethToDeposit}(); + IWETH9(weth).deposit{ value: _wethToDeposit }(); IWETH9(weth).approve(address(leverageBull), _wethToDeposit); leverageBull.depositAndBorrowFromLeverage(_wethToDeposit, 0); vm.stopPrank(); @@ -202,7 +202,7 @@ contract LeverageZenFuzzTest is Test { vm.startPrank(auction); // deposit first WETH in euler - IWETH9(weth).deposit{value: _wethToDeposit}(); + IWETH9(weth).deposit{ value: _wethToDeposit }(); IWETH9(weth).approve(address(leverageBull), _wethToDeposit); leverageBull.depositAndBorrowFromLeverage(_wethToDeposit, 0); vm.stopPrank(); diff --git a/packages/zen-bull-vault/test/fuzz-test/ZenAuctionFuzzTest.t.sol b/packages/zen-bull-vault/test/fuzz-test/ZenAuctionFuzzTest.t.sol index 3bfc57354..2dee2ec43 100644 --- a/packages/zen-bull-vault/test/fuzz-test/ZenAuctionFuzzTest.t.sol +++ b/packages/zen-bull-vault/test/fuzz-test/ZenAuctionFuzzTest.t.sol @@ -188,9 +188,9 @@ contract ZenAuctionFuzzTest is Test { IERC20(wPowerPerp).transfer(user2, 500e18); // mint more oSQTH vm.prank(user1); - controller.mintWPowerPerpAmount{value: 100000e18}(0, 10000e18, 0); + controller.mintWPowerPerpAmount{ value: 100000e18 }(0, 10000e18, 0); vm.prank(user2); - controller.mintWPowerPerpAmount{value: 100000e18}(0, 10000e18, 0); + controller.mintWPowerPerpAmount{ value: 100000e18 }(0, 10000e18, 0); _initateDepositInBull(); } @@ -213,8 +213,8 @@ contract ZenAuctionFuzzTest is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -473,7 +473,7 @@ contract ZenAuctionFuzzTest is Test { }); vm.startPrank(user1); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); diff --git a/packages/zen-bull-vault/test/fuzz-test/ZenBullStrategyFuzzTest.t.sol b/packages/zen-bull-vault/test/fuzz-test/ZenBullStrategyFuzzTest.t.sol index 958fde44c..1748fd517 100644 --- a/packages/zen-bull-vault/test/fuzz-test/ZenBullStrategyFuzzTest.t.sol +++ b/packages/zen-bull-vault/test/fuzz-test/ZenBullStrategyFuzzTest.t.sol @@ -114,7 +114,7 @@ contract ZenBullStrategyFuzzTest is Test { vm.startPrank(user1); IERC20(crabV2).approve(address(bullStrategy), _crabAmount); - bullStrategy.deposit{value: wethToLend}(_crabAmount); + bullStrategy.deposit{ value: wethToLend }(_crabAmount); vm.stopPrank(); assertEq(bullStrategy.balanceOf(user1).sub(userBullBalanceBefore), bullToMint); @@ -144,7 +144,7 @@ contract ZenBullStrategyFuzzTest is Test { (uint256 wethToLend,) = testUtil.calcCollateralAndBorrowAmount(_crabAmount); vm.startPrank(user1); IERC20(crabV2).approve(address(bullStrategy), _crabAmount); - bullStrategy.deposit{value: wethToLend}(_crabAmount); + bullStrategy.deposit{ value: wethToLend }(_crabAmount); vm.stopPrank(); (uint256 wPowerPerpToRedeem, uint256 crabToRedeem) = diff --git a/packages/zen-bull-vault/test/integration-test/FlashZenTestFork.t.sol b/packages/zen-bull-vault/test/integration-test/FlashZenTestFork.t.sol index bcd13c07f..601a00ad2 100644 --- a/packages/zen-bull-vault/test/integration-test/FlashZenTestFork.t.sol +++ b/packages/zen-bull-vault/test/integration-test/FlashZenTestFork.t.sol @@ -172,7 +172,7 @@ contract FlashZenTestFork is Test { }); vm.startPrank(user1); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); @@ -227,7 +227,7 @@ contract FlashZenTestFork is Test { }); vm.startPrank(user1); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); @@ -274,7 +274,7 @@ contract FlashZenTestFork is Test { vm.startPrank(user1); vm.expectRevert(bytes("amount out less than min")); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); } @@ -314,7 +314,7 @@ contract FlashZenTestFork is Test { vm.startPrank(user1); vm.expectRevert(bytes("amount out less than min")); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); } @@ -354,7 +354,7 @@ contract FlashZenTestFork is Test { vm.startPrank(user1); vm.expectRevert(); - flashBull.flashDeposit{value: totalEthToBull.sub(5e18)}(params); + flashBull.flashDeposit{ value: totalEthToBull.sub(5e18) }(params); vm.stopPrank(); } @@ -395,7 +395,7 @@ contract FlashZenTestFork is Test { }); vm.startPrank(user1); - flashBull.flashDeposit{value: totalEthToBull}(firstParams); + flashBull.flashDeposit{ value: totalEthToBull }(firstParams); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); assertApproxEqAbs( @@ -848,7 +848,7 @@ contract FlashZenTestFork is Test { testUtil.calcCollateralAndBorrowAmount(_crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), _crabToDeposit); - bullStrategy.deposit{value: wethToLend}(_crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(_crabToDeposit); return (wethToLend, usdcToBorrow); } diff --git a/packages/zen-bull-vault/test/integration-test/ZenAuctionTestFork.t.sol b/packages/zen-bull-vault/test/integration-test/ZenAuctionTestFork.t.sol index c30705bfd..660b301f9 100644 --- a/packages/zen-bull-vault/test/integration-test/ZenAuctionTestFork.t.sol +++ b/packages/zen-bull-vault/test/integration-test/ZenAuctionTestFork.t.sol @@ -190,9 +190,9 @@ contract ZenAuctionTestFork is Test { IERC20(wPowerPerp).transfer(user2, 500e18); // mint more oSQTH vm.prank(user1); - controller.mintWPowerPerpAmount{value: 100000e18}(0, 10000e18, 0); + controller.mintWPowerPerpAmount{ value: 100000e18 }(0, 10000e18, 0); vm.prank(user2); - controller.mintWPowerPerpAmount{value: 100000e18}(0, 10000e18, 0); + controller.mintWPowerPerpAmount{ value: 100000e18 }(0, 10000e18, 0); _initateDepositInBull(); } @@ -326,7 +326,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -434,7 +434,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -561,7 +561,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -673,7 +673,7 @@ contract ZenAuctionTestFork is Test { function testLeverageRebalanceWhereCrIsInvalid() public { vm.startPrank(user1); - IWETH9(weth).deposit{value: 50000e18}(); + IWETH9(weth).deposit{ value: 50000e18 }(); IERC20(weth).approve(address(swapRouter), 50000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -727,7 +727,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 100e18}(); + IWETH9(weth).deposit{ value: 100e18 }(); IERC20(weth).approve(address(swapRouter), 100e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -785,7 +785,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -893,7 +893,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1002,7 +1002,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1113,7 +1113,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1221,7 +1221,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1329,7 +1329,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1439,7 +1439,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1544,7 +1544,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1650,7 +1650,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1776,7 +1776,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1886,7 +1886,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -1996,7 +1996,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 2000e18}(); + IWETH9(weth).deposit{ value: 2000e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -2128,7 +2128,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -2278,7 +2278,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -2396,7 +2396,7 @@ contract ZenAuctionTestFork is Test { { // move prices up vm.startPrank(user1); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -2523,8 +2523,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -2704,8 +2704,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -2885,8 +2885,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -3066,8 +3066,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -3247,8 +3247,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -3433,8 +3433,8 @@ contract ZenAuctionTestFork is Test { IERC20(usdc).approve(address(swapRouter), type(uint256).max); IERC20(weth).approve(address(swapRouter), type(uint256).max); IERC20(wPowerPerp).approve(address(swapRouter), type(uint256).max); - IWETH9(weth).deposit{value: sellWethBuyWPowerPerpAmount}(); - IWETH9(weth).deposit{value: sellWethBuyUsdcAmount}(); + IWETH9(weth).deposit{ value: sellWethBuyWPowerPerpAmount }(); + IWETH9(weth).deposit{ value: sellWethBuyUsdcAmount }(); IERC20(wPowerPerp).approve(address(auctionBull), type(uint256).max); swapRouter.exactInputSingle( @@ -3616,7 +3616,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -3746,7 +3746,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -3927,7 +3927,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 200e18}(); + IWETH9(weth).deposit{ value: 200e18 }(); IERC20(weth).approve(address(swapRouter), 200e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4105,7 +4105,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4296,7 +4296,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4443,7 +4443,7 @@ contract ZenAuctionTestFork is Test { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4635,7 +4635,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 100e18}(); + IWETH9(weth).deposit{ value: 100e18 }(); IERC20(weth).approve(address(swapRouter), 100e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4706,7 +4706,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 100e18}(); + IWETH9(weth).deposit{ value: 100e18 }(); IERC20(weth).approve(address(swapRouter), 100e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4748,7 +4748,7 @@ contract ZenAuctionTestFork is Test { function testLeverageRebalanceWhenEthDownWhenDeltaTooLowAfterTrade() public { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4817,7 +4817,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 100e18}(); + IWETH9(weth).deposit{ value: 100e18 }(); IERC20(weth).approve(address(swapRouter), 100e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4859,7 +4859,7 @@ contract ZenAuctionTestFork is Test { function testLeverageRebalanceWhenEthDownWhenCrTooLowAfterTrade() public { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4927,7 +4927,7 @@ contract ZenAuctionTestFork is Test { sqrtPriceLimitX96: 0 }) ); - IWETH9(weth).deposit{value: 100e18}(); + IWETH9(weth).deposit{ value: 100e18 }(); IERC20(weth).approve(address(swapRouter), 100e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -4968,7 +4968,7 @@ contract ZenAuctionTestFork is Test { function testLeverageRebalanceWhenEthDownEthLimitTooLow() public { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -5023,7 +5023,7 @@ contract ZenAuctionTestFork is Test { function testLeverageRebalanceWhenEthDown() public { // move prices down vm.startPrank(user1); - IWETH9(weth).deposit{value: 10000e18}(); + IWETH9(weth).deposit{ value: 10000e18 }(); IERC20(weth).approve(address(swapRouter), 10000e18); swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ @@ -5188,7 +5188,7 @@ contract ZenAuctionTestFork is Test { }); vm.startPrank(user1); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); diff --git a/packages/zen-bull-vault/test/integration-test/ZenBullStrategyTestFork.t.sol b/packages/zen-bull-vault/test/integration-test/ZenBullStrategyTestFork.t.sol index 79b4f670b..0eaee0b9e 100644 --- a/packages/zen-bull-vault/test/integration-test/ZenBullStrategyTestFork.t.sol +++ b/packages/zen-bull-vault/test/integration-test/ZenBullStrategyTestFork.t.sol @@ -191,7 +191,7 @@ contract ZenBullStrategyTestFork is Test { vm.startPrank(user1); IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); vm.expectRevert(bytes("BS2")); - bullStrategy.deposit{value: wethToLend}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(crabToDeposit); vm.stopPrank(); } @@ -201,7 +201,7 @@ contract ZenBullStrategyTestFork is Test { (uint256 wethToLend,) = testUtil.calcCollateralAndBorrowAmount(crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); vm.expectRevert(bytes("BS9")); - bullStrategy.deposit{value: wethToLend}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(crabToDeposit); vm.stopPrank(); } @@ -213,7 +213,7 @@ contract ZenBullStrategyTestFork is Test { IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); vm.expectRevert(bytes("LB0")); // Deposit 1 ETH less than needed - bullStrategy.deposit{value: wethToLend.sub(1e18)}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend.sub(1e18) }(crabToDeposit); vm.stopPrank(); } @@ -227,7 +227,7 @@ contract ZenBullStrategyTestFork is Test { testUtil.calcCollateralAndBorrowAmount(crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); // Deposit 1 ETH more than needed (will refund) - bullStrategy.deposit{value: wethToLend.add(1e18)}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend.add(1e18) }(crabToDeposit); vm.stopPrank(); uint256 userEthBalanceAfter = address(user1).balance; uint256 bullCrabBalanceAfter = bullStrategy.getCrabBalance(); @@ -394,7 +394,7 @@ contract ZenBullStrategyTestFork is Test { function testReceiveFromNonWethOrCrab() public { vm.startPrank(user1); - (bool status, bytes memory returndata) = address(bullStrategy).call{value: 5e18}(""); + (bool status, bytes memory returndata) = address(bullStrategy).call{ value: 5e18 }(""); vm.stopPrank(); assertFalse(status); assertEq(_getRevertMsg(returndata), "BS1"); @@ -407,7 +407,7 @@ contract ZenBullStrategyTestFork is Test { (uint256 wethToLend,) = testUtil.calcCollateralAndBorrowAmount(crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); vm.expectRevert(bytes("LB0")); - bullStrategy.deposit{value: wethToLend.wdiv(2e18)}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend.wdiv(2e18) }(crabToDeposit); vm.stopPrank(); } @@ -418,7 +418,7 @@ contract ZenBullStrategyTestFork is Test { (uint256 wethToLend,) = testUtil.calcCollateralAndBorrowAmount(crabToDeposit.wdiv(2e18)); IERC20(crabV2).approve(address(bullStrategy), crabToDeposit); vm.expectRevert(bytes("LB0")); - bullStrategy.deposit{value: wethToLend}(crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(crabToDeposit); vm.stopPrank(); } @@ -491,7 +491,7 @@ contract ZenBullStrategyTestFork is Test { testUtil.calcCollateralAndBorrowAmount(_crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), _crabToDeposit); - bullStrategy.deposit{value: wethToLend}(_crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(_crabToDeposit); return (wethToLend, usdcToBorrow); } diff --git a/packages/zen-bull-vault/test/integration-test/ZenEmergencyShutdownTestFork.t.sol b/packages/zen-bull-vault/test/integration-test/ZenEmergencyShutdownTestFork.t.sol index cd9290cee..5631d5f7e 100644 --- a/packages/zen-bull-vault/test/integration-test/ZenEmergencyShutdownTestFork.t.sol +++ b/packages/zen-bull-vault/test/integration-test/ZenEmergencyShutdownTestFork.t.sol @@ -661,7 +661,7 @@ contract ZenEmergencyShutdownTestFork is Test { testUtil.calcCollateralAndBorrowAmount(_crabToDeposit); IERC20(crabV2).approve(address(bullStrategy), _crabToDeposit); - bullStrategy.deposit{value: wethToLend}(_crabToDeposit); + bullStrategy.deposit{ value: wethToLend }(_crabToDeposit); return (wethToLend, usdcToBorrow); } diff --git a/packages/zen-bull-vault/test/unit-test/ZenBullStrategyTest.t.sol b/packages/zen-bull-vault/test/unit-test/ZenBullStrategyTest.t.sol index 7ca214f16..4f9534d79 100644 --- a/packages/zen-bull-vault/test/unit-test/ZenBullStrategyTest.t.sol +++ b/packages/zen-bull-vault/test/unit-test/ZenBullStrategyTest.t.sol @@ -139,7 +139,7 @@ contract ZenBullStrategyTest is Test { uint256 bullCrabBalanceBefore = bullStrategy.getCrabBalance(); vm.startPrank(auction); - IWETH9(weth).deposit{value: ethToDeposit}(); + IWETH9(weth).deposit{ value: ethToDeposit }(); IWETH9(weth).approve(address(bullStrategy), ethToDeposit); bullStrategy.depositEthIntoCrab(ethToDeposit); vm.stopPrank(); @@ -160,7 +160,7 @@ contract ZenBullStrategyTest is Test { uint256 bullCrabBalanceBefore = bullStrategy.getCrabBalance(); vm.startPrank(auction); - IWETH9(weth).deposit{value: ethToDeposit}(); + IWETH9(weth).deposit{ value: ethToDeposit }(); IWETH9(weth).approve(address(bullStrategy), ethToDeposit); bullStrategy.depositEthIntoCrab(ethToDeposit); vm.stopPrank(); @@ -174,7 +174,7 @@ contract ZenBullStrategyTest is Test { vm.startPrank(0x06CECFbac34101aE41C88EbC2450f8602b3d164b); IERC20(crabV2).approve(address(bullStrategy), crabToRedeem); vm.deal(0x06CECFbac34101aE41C88EbC2450f8602b3d164b, wethToLend); - bullStrategy.deposit{value: wethToLend}(crabToRedeem); + bullStrategy.deposit{ value: wethToLend }(crabToRedeem); vm.stopPrank(); (, uint256 squeethInCrab) = testUtil.getCrabVaultDetails(); @@ -220,7 +220,7 @@ contract ZenBullStrategyTest is Test { }); vm.startPrank(_depositor); - flashBull.flashDeposit{value: totalEthToBull}(params); + flashBull.flashDeposit{ value: totalEthToBull }(params); vm.stopPrank(); assertEq(IEulerDToken(dToken).balanceOf(address(bullStrategy)), usdcToBorrow); From f4295fc9601faaae4a99b2272dd443da7de38466 Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Mon, 27 Feb 2023 14:12:02 +0100 Subject: [PATCH 3/4] update config --- .circleci/config.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index af43f6cc7..25242ce3b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,7 +230,7 @@ jobs: lint-zen-bull-vault: working_directory: ~/squeeth/packages/zen-bull docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -240,7 +240,7 @@ jobs: compile-zen-bull-vault: working_directory: ~/squeeth/packages/zen-bull docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -250,7 +250,7 @@ jobs: test-zen-bull-vault: working_directory: ~/squeeth/packages/zen-bull docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: cd packages/zen-bull-vault && FOUNDRY_PROFILE=test forge test -vv --gas-report @@ -258,7 +258,7 @@ jobs: fuzzing-zen-bull-vault: working_directory: ~/squeeth/packages/zen-bull docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -278,7 +278,7 @@ jobs: lint-crab-netting: working_directory: ~/squeeth/packages/crab-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -288,7 +288,7 @@ jobs: compile-crab-netting: working_directory: ~/squeeth/packages/crab-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -298,7 +298,7 @@ jobs: test-crab-netting: working_directory: ~/squeeth/packages/crab-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: cd packages/crab-netting && forge test -vv --gas-report @@ -307,7 +307,7 @@ jobs: lint-zen-bull-netting: working_directory: ~/squeeth/packages/zen-bull-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -317,7 +317,7 @@ jobs: compile-zen-bull-netting: working_directory: ~/squeeth/packages/zen-bull-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -327,7 +327,7 @@ jobs: test-zen-bull-netting: working_directory: ~/squeeth/packages/zen-bull-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: cd packages/zen-bull-netting && FOUNDRY_PROFILE=test forge test -vv --gas-report @@ -335,7 +335,7 @@ jobs: fuzzing-zen-bull-netting: working_directory: ~/squeeth/packages/zen-bull-netting docker: - - image: ghcr.io/foundry-rs/foundry:latest + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: @@ -345,9 +345,8 @@ jobs: coverage-zen-bull-netting: working_directory: ~/squeeth/packages/zen-bull-netting - docker: - # - image: ghcr.io/foundry-rs/foundry:nightly-e9f274df045d36527eff66f8a6d4e836c7227231 - - image: ghcr.io/foundry-rs/foundry:latest + docker: + - image: ghcr.io/foundry-rs/foundry:nightly-0078471691de77b017b16ba0cd7aac6734b58db6 steps: - checkout - run: cd packages/zen-bull-netting && FOUNDRY_PROFILE=coverage forge coverage From 4163622bc886e21a8b4c7257f042388246c6cf4c Mon Sep 17 00:00:00 2001 From: Haythem Sellami Date: Mon, 27 Feb 2023 14:29:10 +0100 Subject: [PATCH 4/4] rename --- packages/hardhat/scripts/start_hardhat_fork.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hardhat/scripts/start_hardhat_fork.sh b/packages/hardhat/scripts/start_hardhat_fork.sh index e64f64cf1..a4df396f4 100755 --- a/packages/hardhat/scripts/start_hardhat_fork.sh +++ b/packages/hardhat/scripts/start_hardhat_fork.sh @@ -6,6 +6,6 @@ alchemyKey=$ALCHEMY_KEY -echo "Using the current infura key: ${alchemyKey}" +echo "Using the current alchemy key: ${alchemyKey}" $(npm bin)/hardhat node --no-deploy --network hardhat --fork https://eth-mainnet.g.alchemy.com/v2/$alchemyKey \ No newline at end of file