diff --git a/package.json b/package.json index ab5e730f..1c128ed3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "workspaces": { "packages": [ "packages/**" - ] + ], + "nohoist": ["**/@openzeppelin/contracts"] }, "scripts": { "dev": "lerna run --scope @oasisdex/dma-contracts dev", diff --git a/packages/dma-contracts/contracts/actions/common/TakeFlashloanBalancer.sol b/packages/dma-contracts/contracts/actions/common/TakeFlashloanBalancer.sol index 694f2ba4..3854898b 100644 --- a/packages/dma-contracts/contracts/actions/common/TakeFlashloanBalancer.sol +++ b/packages/dma-contracts/contracts/actions/common/TakeFlashloanBalancer.sol @@ -13,7 +13,6 @@ import { BALANCER_VAULT } from "../../core/constants/Balancer.sol"; import { ProxyPermission } from "../../libs/DS/ProxyPermission.sol"; import { IERC20 } from "../../libs/SafeERC20.sol"; -import "../../libs/FixedPoint.sol"; import { UseStorageSlot, StorageSlot, StorageSlot } from "../../libs/UseStorageSlot.sol"; import { UseRegistry } from "../../libs/UseRegistry.sol"; diff --git a/packages/dma-contracts/contracts/core/OperationExecutor.sol b/packages/dma-contracts/contracts/core/OperationExecutor.sol index 58aac933..61fb354f 100644 --- a/packages/dma-contracts/contracts/core/OperationExecutor.sol +++ b/packages/dma-contracts/contracts/core/OperationExecutor.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.24; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { OperationsRegistry } from "./OperationsRegistry.sol"; import { ServiceRegistry } from "../core/ServiceRegistry.sol"; import { ChainLogView } from "../core/views/ChainLogView.sol"; @@ -31,7 +32,7 @@ interface IProxy { * Also it acts as a flashloan recipient */ -contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseStorageSlot { +contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseStorageSlot, ReentrancyGuard { using ActionAddress for address; using SafeERC20 for IERC20; using StorageSlot for bytes32; @@ -83,7 +84,7 @@ contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseSto * * @param calls List of action calls to be executed. */ - function executeOp(Call[] memory calls) external payable returns (bytes32) { + function executeOp(Call[] memory calls) external nonReentrant payable returns (bytes32) { aggregate(calls); bytes32[] memory actions = getActionsStorageSlot().returnStoredArray(); @@ -145,7 +146,7 @@ contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseSto FlashloanData memory flData = abi.decode(data, (FlashloanData)); address mcdFlash = CHAINLOG_VIEWER.getServiceAddress(MCD_FLASH); - checkIfLenderIsTrusted(mcdFlash); + checkIfSenderIsTrusted(mcdFlash); checkIfFlashloanedAssetIsTheRequiredOne(asset, flData.asset); checkIfFlashloanedAmountIsTheRequiredOne(asset, flData.amount); processFlashloan(flData, initiator); @@ -180,7 +181,7 @@ contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseSto address asset = address(tokens[0]); (FlashloanData memory flData, address initiator) = abi.decode(data, (FlashloanData, address)); - checkIfLenderIsTrusted(BALANCER_VAULT); + checkIfSenderIsTrusted(BALANCER_VAULT); checkIfFlashloanedAssetIsTheRequiredOne(asset, flData.asset); checkIfFlashloanedAmountIsTheRequiredOne(asset, flData.amount); @@ -196,7 +197,7 @@ contract OperationExecutor is IERC3156FlashBorrower, IFlashLoanRecipient, UseSto IERC20(asset).safeTransfer(BALANCER_VAULT, paybackAmount); } - function checkIfLenderIsTrusted(address lender) public view { + function checkIfSenderIsTrusted(address lender) public view { if (msg.sender != lender) revert UntrustedLender(msg.sender); } diff --git a/packages/dma-contracts/hardhat.config.base.ts b/packages/dma-contracts/hardhat.config.base.ts index 9fac854f..37b6d779 100644 --- a/packages/dma-contracts/hardhat.config.base.ts +++ b/packages/dma-contracts/hardhat.config.base.ts @@ -200,7 +200,6 @@ const config = { }, hardfork: 'cancun', gas: 'auto', - initialBaseFeePerGas: 1000000000, allowUnlimitedContractSize: true, }, ...(includeGoerli