Skip to content

Commit 3b22daf

Browse files
authored
Merge pull request #259 from morpho-org/chore/foundry-v1.4.1
Foundry v1.4
2 parents e6fdcbc + 736ecf1 commit 3b22daf

20 files changed

+187
-78
lines changed

certora/confs/GeneralAdapter1Reverts.conf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,21 @@
2828
"packages": [
2929
"solmate=lib/permit2/lib/solmate"
3030
],
31-
"solc_via_ir": true,
31+
"solc_via_ir_map": {
32+
"Morpho": true,
33+
"Bundler3": true,
34+
"GeneralAdapter1": true,
35+
"ERC4626Mock": true,
36+
"ERC20Mock": true,
37+
"ERC20NoRevert": true,
38+
"ERC20USDT": true,
39+
"ERC20Standard": true,
40+
"SafeERC20": true,
41+
"Address": true,
42+
"Permit2Lib": true,
43+
"Permit2": true,
44+
"WETH9": false
45+
},
3246
"solc_optimize_map": {
3347
"Morpho": "999999",
3448
"Bundler3": "999999",
@@ -44,7 +58,7 @@
4458
"Permit2": "999999",
4559
"WETH9": "0"
4660
},
47-
"solc_map": {
61+
"compiler_map": {
4862
"Morpho": "solc-0.8.19",
4963
"Bundler3": "solc-0.8.28",
5064
"GeneralAdapter1": "solc-0.8.28",

certora/confs/MorphoZeroConditions.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"solc_via_ir": true,
1313
"solc_optimize": "999999",
14-
"solc_map": {
14+
"compiler_map": {
1515
"Morpho": "solc-0.8.19",
1616
"GeneralAdapter1": "solc-0.8.28"
1717
},

certora/confs/OnlyBundler3.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
],
4242
"solc_via_ir": true,
4343
"solc_optimize": "99999",
44-
"solc_map": {
44+
"compiler_map": {
4545
"Morpho": "solc-0.8.19",
4646
"Bundler3": "solc-0.8.28",
4747
"EthereumGeneralAdapter1": "solc-0.8.28",

certora/confs/ReenterCaller.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
],
4343
"solc_via_ir": true,
4444
"solc_optimize": "99999",
45-
"solc_map": {
45+
"compiler_map": {
4646
"Morpho": "solc-0.8.19",
4747
"Bundler3": "solc-0.8.28",
4848
"EthereumGeneralAdapter1": "solc-0.8.28",

foundry.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"lib/forge-std": {
3+
"rev": "8f24d6b04c92975e0795b5868aa0d783251cdeaa"
4+
},
5+
"lib/morpho-blue": {
6+
"rev": "8fd926254dd21bc6e5bf0ac401202a58f0ffa612"
7+
},
8+
"lib/openzeppelin-contracts": {
9+
"rev": "49cd64565aafa5b8f6863bf60a30ef015861614c"
10+
},
11+
"lib/permit2": {
12+
"rev": "576f549a7351814f112edcc42f3f8472d1712673"
13+
}
14+
}

foundry.toml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[profile.default]
22
names = true
33
fs_permissions = [
4-
{ access = "read", path = "./out/"},
5-
{ access = "read", path = "./config/"}
4+
{ access = "read", path = "./out/" },
5+
{ access = "read", path = "./config/" },
66
]
77
libs = ["lib"]
88
ignored_error_codes = ["transient-storage"]
@@ -16,12 +16,24 @@ evm_version = "cancun"
1616
[profile.default.fuzz]
1717
runs = 64
1818

19-
[profile.default.rpc_endpoints]
19+
[profile.default.fmt]
20+
wrap_comments = true
21+
22+
[lint]
23+
exclude_lints = [
24+
"unsafe-typecast",
25+
"unaliased-plain-import",
26+
"unused-import",
27+
"mixed-case-variable",
28+
"screaming-snake-case-const",
29+
"erc20-unchecked-transfer",
30+
"unwrapped-modifier-logic",
31+
"mixed-case-function",
32+
]
33+
34+
[rpc_endpoints]
2035
ethereum = "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
2136
base = "https://base-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
2237
tenderly = "https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}"
2338

24-
[profile.default.fmt]
25-
wrap_comments = true
26-
2739
# See more config options https://github.com/foundry-rs/foundry/tree/master/crates/config

src/adapters/ParaswapAdapter.sol

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ contract ParaswapAdapter is CoreAdapter, IParaswapAdapter {
202202
/// @notice Sets exact amount in `callData` to `exactAmount`.
203203
/// @notice Proportionally scale limit amount in `callData`.
204204
/// @notice If `offsets.quotedAmount` is not zero, proportionally scale quoted amount in `callData`.
205-
function updateAmounts(bytes memory callData, Offsets calldata offsets, uint256 exactAmount, Math.Rounding rounding)
206-
internal
207-
pure
208-
{
205+
function updateAmounts(
206+
bytes memory callData,
207+
Offsets calldata offsets,
208+
uint256 exactAmount,
209+
Math.Rounding rounding
210+
) internal pure {
209211
uint256 oldExactAmount = callData.get(offsets.exactAmount);
210212
callData.set(offsets.exactAmount, exactAmount);
211213

src/interfaces/IAaveV3Optimizer.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ interface IAaveV3Optimizer {
3636
uint256 deadline,
3737
Signature calldata signature
3838
) external returns (uint256 supplied);
39-
function supplyCollateral(address underlying, uint256 amount, address onBehalf)
40-
external
41-
returns (uint256 supplied);
39+
function supplyCollateral(address underlying, uint256 amount, address onBehalf) external returns (uint256 supplied);
4240
function supplyCollateralWithPermit(
4341
address underlying,
4442
uint256 amount,

test/MorphoAdapterLocalTest.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,8 @@ contract MorphoAdapterLocalTest is LocalTest {
724724
uint256 currentBorrowPower = totalBorrowPower - borrowed;
725725
if (currentBorrowPower == 0) return;
726726

727-
uint256 maxShares = MorphoUtilsLib.min(currentBorrowPower, availableLiquidity).toSharesDown(
728-
vars.expectedTotalBorrow, vars.expectedBorrowShares
729-
);
727+
uint256 maxShares = MorphoUtilsLib.min(currentBorrowPower, availableLiquidity)
728+
.toSharesDown(vars.expectedTotalBorrow, vars.expectedBorrowShares);
730729
if (maxShares < MIN_AMOUNT) return;
731730
shares = bound(shares % maxShares, MIN_AMOUNT, maxShares);
732731

test/ParaswapAdapterLocalTest.sol

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ contract ParaswapAdapterLocalTest is LocalTest {
4747
vm.assume(sender != address(bundler3));
4848
vm.expectRevert(ErrorsLib.UnauthorizedSender.selector);
4949
vm.prank(sender);
50-
paraswapAdapter.buy(address(augustus), new bytes(32), address(0), address(0), 0, Offsets(0, 0, 0), address(0));
50+
paraswapAdapter.buy(
51+
address(augustus),
52+
new bytes(32),
53+
address(0),
54+
address(0),
55+
0,
56+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
57+
address(0)
58+
);
5159
}
5260

5361
function testBuyMorphoDebtUnauthorized(address sender) public {
@@ -64,7 +72,7 @@ contract ParaswapAdapterLocalTest is LocalTest {
6472
_swapCalldata(0, 1, 1, 1),
6573
address(0),
6674
marketParams,
67-
Offsets(0, 32, 64),
75+
Offsets({exactAmount: 0, limitAmount: 32, quotedAmount: 64}),
6876
address(this),
6977
address(0)
7078
);
@@ -75,7 +83,13 @@ contract ParaswapAdapterLocalTest is LocalTest {
7583
vm.expectRevert(ErrorsLib.UnauthorizedSender.selector);
7684
vm.prank(sender);
7785
paraswapAdapter.sell(
78-
address(augustus), new bytes(32), address(0), address(0), false, Offsets(0, 0, 0), address(0)
86+
address(augustus),
87+
new bytes(32),
88+
address(0),
89+
address(0),
90+
false,
91+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
92+
address(0)
7993
);
8094
}
8195

@@ -85,7 +99,15 @@ contract ParaswapAdapterLocalTest is LocalTest {
8599
vm.prank(address(bundler3));
86100

87101
vm.expectRevert(ErrorsLib.InvalidAugustus.selector);
88-
paraswapAdapter.sell(_augustus, new bytes(32), address(0), address(0), false, Offsets(0, 0, 0), address(0));
102+
paraswapAdapter.sell(
103+
_augustus,
104+
new bytes(32),
105+
address(0),
106+
address(0),
107+
false,
108+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
109+
address(0)
110+
);
89111
}
90112

91113
function testAugustusInRegistryBuyCheck(address _augustus) public {
@@ -94,7 +116,15 @@ contract ParaswapAdapterLocalTest is LocalTest {
94116
vm.prank(address(bundler3));
95117

96118
vm.expectRevert(ErrorsLib.InvalidAugustus.selector);
97-
paraswapAdapter.buy(_augustus, new bytes(32), address(0), address(0), 0, Offsets(0, 0, 0), address(0));
119+
paraswapAdapter.buy(
120+
_augustus,
121+
new bytes(32),
122+
address(0),
123+
address(0),
124+
0,
125+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
126+
address(0)
127+
);
98128
}
99129

100130
function testMinDestAmountZeroBuy() public {
@@ -113,7 +143,13 @@ contract ParaswapAdapterLocalTest is LocalTest {
113143
vm.expectRevert(ErrorsLib.ZeroAddress.selector);
114144
vm.prank(address(bundler3));
115145
paraswapAdapter.sell(
116-
address(augustus), new bytes(32), address(0), address(0), false, Offsets(0, 0, 0), address(0)
146+
address(augustus),
147+
new bytes(32),
148+
address(0),
149+
address(0),
150+
false,
151+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
152+
address(0)
117153
);
118154
}
119155

@@ -126,7 +162,7 @@ contract ParaswapAdapterLocalTest is LocalTest {
126162
address(0),
127163
address(0),
128164
1,
129-
Offsets(0, 0, 0),
165+
Offsets({exactAmount: 0, limitAmount: 0, quotedAmount: 0}),
130166
address(0)
131167
);
132168
}
@@ -197,7 +233,7 @@ contract ParaswapAdapterLocalTest is LocalTest {
197233
address(collateralToken),
198234
address(loanToken),
199235
true,
200-
Offsets(offset, offset + 32, quotedOffset),
236+
Offsets({exactAmount: offset, limitAmount: offset + 32, quotedAmount: quotedOffset}),
201237
address(1)
202238
)
203239
)
@@ -271,7 +307,7 @@ contract ParaswapAdapterLocalTest is LocalTest {
271307
address(collateralToken),
272308
address(loanToken),
273309
adjustedExact,
274-
Offsets(offset, offset + 32, quotedOffset),
310+
Offsets({exactAmount: offset, limitAmount: offset + 32, quotedAmount: quotedOffset}),
275311
address(1)
276312
)
277313
)

0 commit comments

Comments
 (0)