Skip to content

Commit eac9b1a

Browse files
authored
fix(FlashMintLeveragedZeroEx): Make rounding error margin configurable (#210)
1 parent 199337f commit eac9b1a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

contracts/exchangeIssuance/FlashmintLeveragedZeroEx.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ contract FlashMintLeveragedZeroEx is ReentrancyGuard, Ownable {
8787
/* ============ Constants ============= */
8888

8989
uint256 private constant MAX_UINT256 = type(uint256).max;
90-
uint256 public constant ROUNDING_ERROR_MARGIN = 2;
9190
address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
9291

9392
/* ============ State Variables ============ */
9493

94+
uint256 public immutable ROUNDING_ERROR_MARGIN;
9595
IController public immutable setController;
9696
IDebtIssuanceModule public immutable debtIssuanceModule;
9797
IMorphoLeverageModule public immutable morphoLeverageModule;
@@ -140,7 +140,8 @@ contract FlashMintLeveragedZeroEx is ReentrancyGuard, Ownable {
140140
IMorpho _morpho,
141141
IPool _aavePool,
142142
IWETH _weth,
143-
address _swapTarget
143+
address _swapTarget,
144+
uint256 _roundingErrorMargin
144145
)
145146
public
146147
{
@@ -152,6 +153,7 @@ contract FlashMintLeveragedZeroEx is ReentrancyGuard, Ownable {
152153
aavePool = _aavePool;
153154
weth = _weth;
154155
swapTargetWhitelist[_swapTarget] = true;
156+
ROUNDING_ERROR_MARGIN = _roundingErrorMargin;
155157
}
156158

157159
/* ============ External Functions ============ */

utils/deploys/deployExtensions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
DEXAdapterV5__factory,
5454
DEXAdapterV5,
5555
FlashMintLeveragedZeroEx__factory,
56-
FlashMintLeveragedZeroExBalancerFL__factory
56+
FlashMintLeveragedZeroExBalancerFL__factory,
5757
} from "../../typechain";
5858
import { AirdropExtension__factory } from "../../typechain/factories/AirdropExtension__factory";
5959
import { AuctionRebalanceExtension__factory } from "../../typechain/factories/AuctionRebalanceExtension__factory";
@@ -465,6 +465,7 @@ export default class DeployExtensions {
465465
aaveV3PoolAddress: Address,
466466
wethAddress: Address,
467467
swapTarget: Address,
468+
roundingMargin: BigNumberish = 2,
468469
) {
469470
console.log("Deploying FlashMintLeveragedZeroEx", {
470471
wethAddress,
@@ -486,6 +487,7 @@ export default class DeployExtensions {
486487
aaveV3PoolAddress,
487488
wethAddress,
488489
swapTarget,
490+
roundingMargin,
489491
);
490492
}
491493

0 commit comments

Comments
 (0)