Skip to content

Commit b2fd6e6

Browse files
Merge pull request #33 from euler-xyz/fix-import-paths
Absolute import paths
2 parents 773453b + 5ac0a9a commit b2fd6e6

19 files changed

+93
-43
lines changed

.github/workflows/certora-prover.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
with:
2929
submodules: recursive
3030

31+
# Install foundry, needed for prover path resolution
32+
- name: Install Foundry
33+
uses: foundry-rs/foundry-toolchain@v1
34+
3135
# Run Certora munge script
3236
- name: Certora munge
3337
run: ./certora/scripts/patch.sh

certora/confs/BaseConfForInheritance.conf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
"VaultMock1:_asset=Token0",
2424
"EulerEarnHarness:_asset=Token0"
2525
],
26-
"packages": [
27-
"ethereum-vault-connector=lib/ethereum-vault-connector/src",
28-
"euler-vault-kit=lib/euler-vault-kit/src",
29-
"forge-std=lib/forge-std/src",
30-
"solmate=lib/euler-vault-kit/lib/permit2/lib/solmate"
31-
],
3226
"compiler_map": {
3327
"EulerEarnHarness": "solc-0.8.26",
3428
"EthereumVaultConnector": "solc-0.8.26",

certora/confs/Solvency.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"process": "emv",
1111
"prover_args": [
1212
"-cvlFunctionRevert true",
13-
"-depth 0"
13+
"-depth 0",
14+
"-disabledTransformations OPTIMIZE_INFEASIBLE_PATHS",
1415
],
1516
"override_base_config": "certora/confs/BaseConfForInheritance.conf"
1617
}

certora/confs/SolvencyInternal.conf

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,56 @@
99
"-cvlFunctionRevert true",
1010
"-depth 0"
1111
],
12-
"override_base_config": "certora/confs/BaseConfForInheritance.conf"
12+
"optimistic_loop": true,
13+
"global_timeout": "7200",
14+
"parametric_contracts": "EulerEarnHarness",
15+
"rule_sanity": "basic",
16+
"files": [
17+
"certora/harnesses/EulerEarnHarness.sol",
18+
"lib/ethereum-vault-connector/src/EthereumVaultConnector.sol",
19+
"lib/euler-vault-kit/lib/permit2/src/Permit2.sol",
20+
"src/EulerEarnFactory.sol",
21+
"test/mocks/PerspectiveMock.sol",
22+
"certora/mocks/VaultMock0.sol",
23+
"certora/mocks/VaultMock1.sol",
24+
"certora/mocks/Token0.sol",
25+
"certora/harnesses/ERC20Helper.sol"
26+
],
27+
"link": [
28+
"EulerEarnHarness:evc=EthereumVaultConnector",
29+
"EulerEarnHarness:permit2Address=Permit2",
30+
"EulerEarnFactory:permit2Address=Permit2",
31+
"EulerEarnFactory:perspective=PerspectiveMock",
32+
"VaultMock0:_asset=Token0",
33+
"VaultMock1:_asset=Token0",
34+
"EulerEarnHarness:_asset=Token0"
35+
],
36+
"compiler_map": {
37+
"EulerEarnHarness": "solc-0.8.26",
38+
"EthereumVaultConnector": "solc-0.8.26",
39+
"Permit2": "solc-0.8.17",
40+
"EulerEarnFactory": "solc-0.8.26",
41+
"PerspectiveMock": "solc-0.8.26",
42+
"IRMLinearKink": "solc-0.8.26",
43+
"VaultMock0": "solc-0.8.26",
44+
"VaultMock1": "solc-0.8.26",
45+
"Token0": "solc-0.8.26",
46+
"ERC20Helper": "solc-0.8.26"
47+
},
48+
"solc_optimize": "200",
49+
"process": "emv",
50+
"build_cache": true,
51+
"smt_timeout": "6000",
52+
"solc_via_ir_map": {
53+
"ERC20Helper": false,
54+
"EthereumVaultConnector": false,
55+
"EulerEarnFactory": false,
56+
"EulerEarnHarness": false,
57+
"IRMLinearKink": false,
58+
"Permit2": true,
59+
"PerspectiveMock": false,
60+
"Token0": false,
61+
"VaultMock0": false,
62+
"VaultMock1": false
63+
},
1364
}

certora/harnesses/ERC20Helper.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
pragma solidity 0.8.26;
33

4-
import {SafeERC20, IERC20} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
4+
import {SafeERC20, IERC20} from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
55

66
contract ERC20Helper {
77
using SafeERC20 for IERC20;

certora/mocks/Token0.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.8.21;
33

4-
import {ERC20} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
4+
import {ERC20} from "openzeppelin-contracts/token/ERC20/ERC20.sol";
55

66
contract Token0 is ERC20 {
77
constructor() ERC20("Token0", "TOK0") {}

certora/mocks/VaultMock0.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ERC20,
88
ERC4626,
99
Math
10-
} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol";
10+
} from "openzeppelin-contracts/token/ERC20/extensions/ERC4626.sol";
1111

1212
contract VaultMock0 is ERC4626 {
1313
constructor(IERC20 asset) ERC4626(asset) ERC20("VaultMock0", "V0") {}

certora/mocks/VaultMock1.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ERC20,
88
ERC4626,
99
Math
10-
} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol";
10+
} from "openzeppelin-contracts/token/ERC20/extensions/ERC4626.sol";
1111

1212
contract VaultMock1 is ERC4626 {
1313
constructor(IERC20 asset) ERC4626(asset) ERC20("VaultMock1", "V1") {}

certora/scripts/EulerEarn.patch

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/EulerEarn.sol b/src/EulerEarn.sol
2-
index 4635a89..ae0869b 100644
2+
index 27c1873..1efc278 100644
33
--- a/src/EulerEarn.sol
44
+++ b/src/EulerEarn.sol
5-
@@ -106,6 +106,18 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
5+
@@ -106,6 +106,17 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
66
/// @dev "Overrides" the ERC20's storage variable to be able to modify it.
77
string private _symbol;
88

@@ -14,14 +14,13 @@ index 4635a89..ae0869b 100644
1414
+ // The last index at which a market identifier has been removed from the withdraw queue.
1515
+ mapping(address => uint256) public deletedAt;
1616
+
17-
+ // hooks for cvl assertions
1817
+ function HOOK_after_accrueInterest() internal {}
1918
+ function HOOK_after_withdrawStrategy(uint256) internal {}
2019
+
2120
/* CONSTRUCTOR */
2221

2322
/// @dev Initializes the contract.
24-
@@ -353,6 +365,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
23+
@@ -353,6 +364,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
2524
seen[prevIndex] = true;
2625

2726
newWithdrawQueue[i] = id;
@@ -31,7 +30,7 @@ index 4635a89..ae0869b 100644
3130
}
3231

3332
for (uint256 i; i < currLength; ++i) {
34-
@@ -369,6 +384,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
33+
@@ -369,6 +383,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
3534
revert ErrorsLib.InvalidMarketRemovalTimelockNotElapsed(id);
3635
}
3736
}
@@ -41,39 +40,39 @@ index 4635a89..ae0869b 100644
4140

4241
delete config[id];
4342
}
44-
@@ -559,6 +577,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
43+
@@ -559,6 +576,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
4544
/// @inheritdoc IERC4626
4645
function deposit(uint256 assets, address receiver) public override nonReentrant returns (uint256 shares) {
4746
_accrueInterest();
4847
+ HOOK_after_accrueInterest();
4948

5049
shares = _convertToSharesWithTotals(assets, totalSupply(), lastTotalAssets, Math.Rounding.Floor);
5150

52-
@@ -570,6 +589,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
51+
@@ -570,6 +588,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
5352
/// @inheritdoc IERC4626
5453
function mint(uint256 shares, address receiver) public override nonReentrant returns (uint256 assets) {
5554
_accrueInterest();
5655
+ HOOK_after_accrueInterest();
5756

5857
assets = _convertToAssetsWithTotals(shares, totalSupply(), lastTotalAssets, Math.Rounding.Ceil);
5958

60-
@@ -584,6 +604,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
59+
@@ -584,6 +603,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
6160
returns (uint256 shares)
6261
{
6362
_accrueInterest();
6463
+ HOOK_after_accrueInterest();
6564

6665
// Do not call expensive `maxWithdraw` and optimistically withdraw assets.
6766

68-
@@ -600,6 +621,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
67+
@@ -600,6 +620,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
6968
returns (uint256 assets)
7069
{
7170
_accrueInterest();
7271
+ HOOK_after_accrueInterest();
7372

7473
// Do not call expensive `maxRedeem` and optimistically redeem shares.
7574

76-
@@ -729,7 +751,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
75+
@@ -729,7 +750,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
7776
// clamp at 0 so the error raised is the more informative NotEnoughLiquidity.
7877
_updateLastTotalAssets(lastTotalAssets.zeroFloorSub(assets));
7978

@@ -83,7 +82,7 @@ index 4635a89..ae0869b 100644
8382

8483
super._withdraw(caller, receiver, owner, assets, shares);
8584
}
86-
@@ -780,6 +804,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
85+
@@ -780,6 +803,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
8786
IERC20(asset()).forceApproveMaxWithPermit2(address(id), permit2);
8887

8988
if (!marketConfig.enabled) {
@@ -93,7 +92,7 @@ index 4635a89..ae0869b 100644
9392
withdrawQueue.push(id);
9493

9594
if (withdrawQueue.length > ConstantsLib.MAX_QUEUE_LENGTH) revert ErrorsLib.MaxQueueLengthExceeded();
96-
@@ -837,6 +864,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
95+
@@ -837,6 +863,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
9796
/// @dev Withdraws `assets` from the strategy vaults.
9897
function _withdrawStrategy(uint256 assets) internal {
9998
for (uint256 i; i < withdrawQueue.length; ++i) {

remappings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/
12
ethereum-vault-connector/=lib/ethereum-vault-connector/src/

0 commit comments

Comments
 (0)