Skip to content

Commit d49db64

Browse files
Merge pull request #350 from euler-xyz/development
Merge development into master
2 parents 99d3575 + fcb8612 commit d49db64

File tree

57 files changed

+2035
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2035
-297
lines changed
901 KB
Binary file not shown.

foundry.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ fs_permissions = [
1515

1616
gas_reports = ["*"]
1717

18+
[profile.default.lint]
19+
severity = ["high", "med"]
20+
ignore = ["test/**/*.sol", "script/**/*.sol"]
21+
exclude_lints = ["erc20-unchecked-transfer", "unchecked-call"]
22+
1823
[profile.default.fmt]
1924
line_length = 120
2025
tab_width = 4

script/11_FeeFlow.s.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ pragma solidity ^0.8.0;
44

55
import {ScriptUtils} from "./utils/ScriptUtils.s.sol";
66
import {FeeFlowController} from "fee-flow/FeeFlowController.sol";
7+
import {FeeFlowControllerUtil} from "../src/Util/FeeFlowControllerUtil.sol";
78

89
contract FeeFlow is ScriptUtils {
9-
function run() public broadcast returns (address feeFlowController) {
10+
function run() public broadcast returns (address feeFlowController, address feeFlowControllerUtil) {
1011
string memory inputScriptFileName = "11_FeeFlow_input.json";
1112
string memory outputScriptFileName = "11_FeeFlow_output.json";
1213
string memory json = getScriptFile(inputScriptFileName);
@@ -18,11 +19,12 @@ contract FeeFlow is ScriptUtils {
1819
uint256 priceMultiplier = vm.parseJsonUint(json, ".priceMultiplier");
1920
uint256 minInitPrice = vm.parseJsonUint(json, ".minInitPrice");
2021

21-
feeFlowController =
22+
(feeFlowController, feeFlowControllerUtil) =
2223
execute(evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice);
2324

2425
string memory object;
2526
object = vm.serializeAddress("feeFlow", "feeFlowController", feeFlowController);
27+
object = vm.serializeAddress("feeFlow", "feeFlowControllerUtil", feeFlowControllerUtil);
2628
vm.writeJson(object, string.concat(vm.projectRoot(), "/script/", outputScriptFileName));
2729
}
2830

@@ -34,8 +36,8 @@ contract FeeFlow is ScriptUtils {
3436
uint256 epochPeriod,
3537
uint256 priceMultiplier,
3638
uint256 minInitPrice
37-
) public broadcast returns (address feeFlowController) {
38-
feeFlowController =
39+
) public broadcast returns (address feeFlowController, address feeFlowControllerUtil) {
40+
(feeFlowController, feeFlowControllerUtil) =
3941
execute(evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice);
4042
}
4143

@@ -47,11 +49,12 @@ contract FeeFlow is ScriptUtils {
4749
uint256 epochPeriod,
4850
uint256 priceMultiplier,
4951
uint256 minInitPrice
50-
) public returns (address feeFlowController) {
52+
) public returns (address feeFlowController, address feeFlowControllerUtil) {
5153
feeFlowController = address(
5254
new FeeFlowController(
5355
evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice
5456
)
5557
);
58+
feeFlowControllerUtil = address(new FeeFlowControllerUtil(address(feeFlowController)));
5659
}
5760
}

script/50_CoreAndPeriphery.s.sol

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
8484
address uniswapV3Router;
8585
uint256 feeFlowInitPrice;
8686
bool deployOFT;
87+
bool deployEulerEarn;
8788
bool deployEulerSwapV1;
8889
address uniswapPoolManager;
8990
address eulerSwapFeeOwner;
@@ -171,6 +172,7 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
171172
uniswapV3Router: vm.parseJsonAddress(json, ".uniswapV3Router"),
172173
feeFlowInitPrice: vm.parseJsonUint(json, ".feeFlowInitPrice"),
173174
deployOFT: vm.parseJsonBool(json, ".deployOFT"),
175+
deployEulerEarn: vm.parseJsonBool(json, ".deployEulerEarn"),
174176
deployEulerSwapV1: vm.parseJsonBool(json, ".deployEulerSwapV1"),
175177
uniswapPoolManager: vm.parseJsonAddress(json, ".uniswapPoolManager"),
176178
eulerSwapFeeOwner: vm.parseJsonAddress(json, ".eulerSwapFeeOwner"),
@@ -680,13 +682,15 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
680682
console.log("- At least one of the Periphery factories contracts already deployed. Skipping...");
681683
}
682684

683-
if (peripheryAddresses.feeFlowController == address(0)) {
685+
if (
686+
peripheryAddresses.feeFlowController == address(0) && peripheryAddresses.feeFlowControllerUtil == address(0)
687+
) {
684688
address paymentToken = bridgeAddresses.oftAdapter == address(0) ? getWETHAddress() : tokenAddresses.EUL;
685689

686690
if (input.feeFlowInitPrice != 0 && paymentToken != address(0)) {
687-
console.log("+ Deploying FeeFlow...");
691+
console.log("+ Deploying FeeFlowController and FeeFlowControllerUtil...");
688692
FeeFlow deployer = new FeeFlow();
689-
peripheryAddresses.feeFlowController = deployer.deploy(
693+
(peripheryAddresses.feeFlowController, peripheryAddresses.feeFlowControllerUtil) = deployer.deploy(
690694
coreAddresses.evc,
691695
input.feeFlowInitPrice,
692696
paymentToken,
@@ -696,7 +700,9 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
696700
FEE_FLOW_MIN_INIT_PRICE
697701
);
698702
} else {
699-
console.log("! feeFlowInitPrice or paymentToken is not set for FeeFlow deployment. Skipping...");
703+
console.log(
704+
"! feeFlowInitPrice or paymentToken is not set for FeeFlowController and FeeFlowControllerUtil deployment. Skipping..."
705+
);
700706
}
701707

702708
address feeReceiver = peripheryAddresses.feeFlowController == address(0)
@@ -857,10 +863,15 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
857863
}
858864

859865
if (coreAddresses.eulerEarnFactory == address(0) && peripheryAddresses.eulerEarnPublicAllocator == address(0)) {
860-
console.log("+ Deploying EulerEarn factory and public allocator...");
861-
EulerEarnFactoryDeployer deployer = new EulerEarnFactoryDeployer();
862-
(coreAddresses.eulerEarnFactory, peripheryAddresses.eulerEarnPublicAllocator) =
863-
deployer.deploy(coreAddresses.evc, coreAddresses.permit2, peripheryAddresses.evkFactoryPerspective);
866+
if (input.deployEulerEarn) {
867+
console.log("+ Deploying EulerEarn factory and public allocator...");
868+
EulerEarnFactoryDeployer deployer = new EulerEarnFactoryDeployer();
869+
(coreAddresses.eulerEarnFactory, peripheryAddresses.eulerEarnPublicAllocator) =
870+
deployer.deploy(coreAddresses.evc, coreAddresses.permit2, peripheryAddresses.evkFactoryPerspective);
871+
} else {
872+
console.log("- EulerEarn not deployed. Skipping...");
873+
if (vm.isDir("out-euler-earn")) vm.removeDir("out-euler-earn", true);
874+
}
864875
} else {
865876
console.log("- EulerEarn factory and public allocator already deployed. Skipping...");
866877
if (vm.isDir("out-euler-earn")) vm.removeDir("out-euler-earn", true);
@@ -870,11 +881,15 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
870881
peripheryAddresses.eulerEarnFactoryPerspective == address(0)
871882
&& peripheryAddresses.eulerEarnGovernedPerspective == address(0)
872883
) {
873-
console.log("+ Deploying EulerEarnFactoryPerspective and Euler Earn GovernedPerspective...");
874-
EulerEarnPerspectivesDeployer deployer = new EulerEarnPerspectivesDeployer();
875-
address[] memory perspectives = deployer.deploy(coreAddresses.eulerEarnFactory);
876-
peripheryAddresses.eulerEarnFactoryPerspective = perspectives[0];
877-
peripheryAddresses.eulerEarnGovernedPerspective = perspectives[1];
884+
if (input.deployEulerEarn) {
885+
console.log("+ Deploying EulerEarnFactoryPerspective and Euler Earn GovernedPerspective...");
886+
EulerEarnPerspectivesDeployer deployer = new EulerEarnPerspectivesDeployer();
887+
address[] memory perspectives = deployer.deploy(coreAddresses.eulerEarnFactory);
888+
peripheryAddresses.eulerEarnFactoryPerspective = perspectives[0];
889+
peripheryAddresses.eulerEarnGovernedPerspective = perspectives[1];
890+
} else {
891+
console.log("- EulerEarn perspectives not deployed. Skipping...");
892+
}
878893
} else {
879894
console.log("- At least one of the Euler Earn perspectives is already deployed. Skipping...");
880895
}

script/interactiveDeployment.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,10 @@ while true; do
12751275
read -p "Should deploy and configure OFT Adapter? (y/n) (default: n): " deploy_oft
12761276
fi
12771277

1278+
if [ -z "$eulerEarnFactory" ] || [ "$eulerEarnFactory" == "$addressZero" ]; then
1279+
read -p "Should deploy Euler Earn? (y/n) (default: n): " deploy_euler_earn
1280+
fi
1281+
12781282
if [ -z "$eulerSwapV1Factory" ] || [ "$eulerSwapV1Factory" == "$addressZero" ]; then
12791283
read -p "Should deploy EulerSwap V1? (y/n) (default: n): " deploy_euler_swap_v1
12801284

@@ -1295,6 +1299,7 @@ while true; do
12951299
uniswap_router_v3=${uniswap_router_v3:-$addressZero}
12961300
init_price=${init_price:-1000000000000000000}
12971301
deploy_oft=${deploy_oft:-n}
1302+
deploy_euler_earn=${deploy_euler_earn:-n}
12981303
deploy_euler_swap_v1=${deploy_euler_swap_v1:-n}
12991304
uniswap_pool_manager=${uniswap_pool_manager:-$addressZero}
13001305
euler_swap_fee_owner=${euler_swap_fee_owner:-$multisig_dao}
@@ -1323,6 +1328,7 @@ while true; do
13231328
--arg uniswapRouterV3 "$uniswap_router_v3" \
13241329
--arg initPrice "$init_price" \
13251330
--argjson deployOFT "$(jq -n --argjson val \"$deploy_oft\" 'if $val == "y" then true else false end')" \
1331+
--argjson deployEulerEarn "$(jq -n --argjson val \"$deploy_euler_earn\" 'if $val == "y" then true else false end')" \
13261332
--argjson deployEulerSwapV1 "$(jq -n --argjson val \"$deploy_euler_swap_v1\" 'if $val == "y" then true else false end')" \
13271333
--arg uniswapPoolManager "$uniswap_pool_manager" \
13281334
--arg eulerSwapFeeOwner "$euler_swap_fee_owner" \
@@ -1338,6 +1344,7 @@ while true; do
13381344
uniswapV3Router: $uniswapRouterV3,
13391345
feeFlowInitPrice: $initPrice,
13401346
deployOFT: $deployOFT,
1347+
deployEulerEarn: $deployEulerEarn,
13411348
deployEulerSwapV1: $deployEulerSwapV1,
13421349
uniswapPoolManager: $uniswapPoolManager,
13431350
eulerSwapFeeOwner: $eulerSwapFeeOwner,

script/production/CustomScripts.s.sol

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ import {FactoryGovernor} from "../../src/Governor/FactoryGovernor.sol";
1212
import {CapRiskSteward} from "../../src/Governor/CapRiskSteward.sol";
1313
import {GovernorAccessControlEmergency} from "../../src/Governor/GovernorAccessControlEmergency.sol";
1414
import {LayerZeroSendEUL} from "../utils/LayerZeroUtils.s.sol";
15+
import {
16+
LensAccountDeployer,
17+
LensOracleDeployer,
18+
LensIRMDeployer,
19+
LensVaultDeployer,
20+
LensUtilsDeployer,
21+
LensEulerEarnVaultDeployer
22+
} from "../08_Lenses.s.sol";
23+
import {VaultLens, VaultInfoFull} from "../../src/Lens/VaultLens.sol";
24+
import {AccountLens, AccountInfo, AccountMultipleVaultsInfo} from "../../src/Lens/AccountLens.sol";
1525

1626
abstract contract CustomScriptBase is BatchBuilder {
1727
function run() public {
@@ -22,6 +32,24 @@ abstract contract CustomScriptBase is BatchBuilder {
2232
function execute() public virtual {}
2333
}
2434

35+
contract GetVaultInfoFull is ScriptUtils {
36+
function run(address vault) public view returns (VaultInfoFull memory) {
37+
return VaultLens(lensAddresses.vaultLens).getVaultInfoFull(vault);
38+
}
39+
}
40+
41+
contract GetAccountInfo is ScriptUtils {
42+
function run(address account, address vault) public view returns (AccountInfo memory) {
43+
return AccountLens(lensAddresses.accountLens).getAccountInfo(account, vault);
44+
}
45+
}
46+
47+
contract GetAccountEnabledVaultsInfo is ScriptUtils {
48+
function run(address account, address vault) public view returns (AccountMultipleVaultsInfo memory) {
49+
return AccountLens(lensAddresses.accountLens).getAccountEnabledVaultsInfo(account, vault);
50+
}
51+
}
52+
2553
contract BridgeEULToLabsMultisig is ScriptUtils, SafeMultisendBuilder {
2654
function run(uint256 dstChainId, uint256 amountNoDecimals) public {
2755
uint256[] memory dstChainIds = new uint256[](1);
@@ -385,3 +413,25 @@ contract DeployAndConfigureCapRiskSteward is CustomScriptBase {
385413
}
386414
}
387415
}
416+
417+
contract RedeployOracleUtilsAndVaultLenses is CustomScriptBase {
418+
function execute() public override {
419+
{
420+
LensOracleDeployer deployer = new LensOracleDeployer();
421+
lensAddresses.oracleLens = deployer.deploy(peripheryAddresses.oracleAdapterRegistry);
422+
}
423+
{
424+
LensUtilsDeployer deployer = new LensUtilsDeployer();
425+
lensAddresses.utilsLens = deployer.deploy(coreAddresses.eVaultFactory, lensAddresses.oracleLens);
426+
}
427+
{
428+
LensVaultDeployer deployer = new LensVaultDeployer();
429+
lensAddresses.vaultLens =
430+
deployer.deploy(lensAddresses.oracleLens, lensAddresses.utilsLens, lensAddresses.irmLens);
431+
}
432+
{
433+
LensEulerEarnVaultDeployer deployer = new LensEulerEarnVaultDeployer();
434+
lensAddresses.eulerEarnVaultLens = deployer.deploy(lensAddresses.utilsLens);
435+
}
436+
}
437+
}

script/production/ManageClusterBase.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ abstract contract ManageClusterBase is BatchBuilder {
879879
timeDiff -= block.timestamp;
880880
selectFork(block.chainid);
881881

882-
intervals = TimelockController(timelock).getMinDelay() / timeDiff + 1;
882+
intervals = TimelockController(timelock).getMinDelay() / timeDiff + 5;
883883
fromBlock = block.number - intervals * 1e4;
884884
}
885885

script/production/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Options:
115115
- `--emergency-operations` should be used if you intend disable all the operations of the `VAULT_ADDRESS`
116116

117117
```bash
118-
./script/production/ExecuteSolidityScript.sh PATH_TO_CLUSTER_SPECIFIC_SCRIPT --rpc-url RPC_URL --batch-via-safe --safe-address SAFE_ADDRESS --vault-address VAULT_ADDRESS [--emergency-ltv-collateral] [--emergency-ltv-borrowing] [--emergency-caps] [--emergency-caps]
118+
./script/production/ExecuteSolidityScript.sh PATH_TO_CLUSTER_SPECIFIC_SCRIPT --rpc-url RPC_URL --batch-via-safe --safe-address SAFE_ADDRESS --vault-address VAULT_ADDRESS [--emergency-ltv-collateral] [--emergency-ltv-borrowing] [--emergency-caps]
119119
```
120120

121121
Example command for the `PrimeCluster.s.sol` script:

script/production/arbitrum/clusters/ArbitrumCluster.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"0xF7c774aCFA136F527287Dbc05477c015Ee6ED2C9",
1212
"0xF7c774aCFA136F527287Dbc05477c015Ee6ED2C9",
1313
"0xF7c774aCFA136F527287Dbc05477c015Ee6ED2C9",
14+
"0xF7c774aCFA136F527287Dbc05477c015Ee6ED2C9",
1415
"0xabD4606a6643EE58E42f8CdF65F47cA201Cf703f",
1516
"0x9ca9d2f95D0fBf4Aa5ff16ad2B3ebAc04C9bE2Dd"
1617
],
@@ -26,6 +27,7 @@
2627
"0x94B6924796CcC98e5237615F8710Ef5732190F66",
2728
"0x94B6924796CcC98e5237615F8710Ef5732190F66",
2829
"0x94B6924796CcC98e5237615F8710Ef5732190F66",
30+
"0x94B6924796CcC98e5237615F8710Ef5732190F66",
2931
"0x94B6924796CcC98e5237615F8710Ef5732190F66"
3032
],
3133
"stubOracle": "0x0000000000000000000000000000000000000000",
@@ -40,6 +42,7 @@
4042
"0xE96e07C16661744836a742Ef2090F11e84a86f4F",
4143
"0xDBD974Eb5360d053ea0c56B4DaCF4A9D3E894Ee2",
4244
"0xaA525D3142A5BDD3E55E8e983D3789b88F2FEB8f",
45+
"0x1Ed564CFC30b385C9C2B184F25602764dD6A16c9",
4346
"0x889E1c458B2469b70aCcdfb5B59726dC1668896C",
4447
"0x7eD866D2D66c3149FaFE854C30C68a8BA7ceE8B9"
4548
]

0 commit comments

Comments
 (0)