Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deployment script to update cross price #62

Merged
merged 3 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ deploy-testnet:
deploy-holesky:
@forge script script/deploy/DeployManager.sol --rpc-url $(HOLESKY_URL) --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --slow --verify -vvv

simulate-deploys:
@forge script script/deploy/DeployManager.sol --fork-url $(PROVIDER_URL) --private-key ${DEPLOYER_PRIVATE_KEY} -vvvv

# Override default `test` and `coverage` targets
.PHONY: test coverage
31 changes: 16 additions & 15 deletions build/deployments-1.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"executions": {
"001_CoreMainnet": 1723685111,
"002_UpgradeMainnet": 1726812322,
"003_UpgradeLidoARMScript": 1729073099
},
"contracts": {
"LIDO_ARM": "0x85B78AcA6Deae198fBF201c82DAF6Ca21942acc6",
"LIDO_ARM_CAP_IMPL": "0x8506486813d025C5935dF481E450e27D2e483dc9",
"LIDO_ARM_CAP_MAN": "0xf54ebff575f699d281645c6F14Fe427dFFE629CF",
"LIDO_ARM_IMPL": "0x3d724176c8f1F965eF4020CB5DA5ad1a891BEEf1",
"LIDO_ARM_ZAPPER": "0x01F30B7358Ba51f637d1aa05D9b4A60f76DAD680",
"OETH_ARM": "0x6bac785889A4127dB0e0CeFEE88E0a9F1Aaf3cC7",
"OETH_ARM_IMPL": "0x187FfF686a5f42ACaaF56469FcCF8e6Feca18248"
}
}
"executions": {
"001_CoreMainnet": 1723685111,
"002_UpgradeMainnet": 1726812322,
"003_UpgradeLidoARMScript": 1729073099,
"004_UpdateCrossPriceScript": 1739872139
},
"contracts": {
"LIDO_ARM": "0x85B78AcA6Deae198fBF201c82DAF6Ca21942acc6",
"LIDO_ARM_CAP_IMPL": "0x8506486813d025C5935dF481E450e27D2e483dc9",
"LIDO_ARM_CAP_MAN": "0xf54ebff575f699d281645c6F14Fe427dFFE629CF",
"LIDO_ARM_IMPL": "0x3d724176c8f1F965eF4020CB5DA5ad1a891BEEf1",
"LIDO_ARM_ZAPPER": "0x01F30B7358Ba51f637d1aa05D9b4A60f76DAD680",
"OETH_ARM": "0x6bac785889A4127dB0e0CeFEE88E0a9F1Aaf3cC7",
"OETH_ARM_IMPL": "0x187FfF686a5f42ACaaF56469FcCF8e6Feca18248"
}
}
2 changes: 2 additions & 0 deletions script/deploy/DeployManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {AbstractDeployScript} from "./AbstractDeployScript.sol";
import {DeployCoreMainnetScript} from "./mainnet/001_DeployCoreScript.sol";
import {UpgradeMainnetScript} from "./mainnet/002_UpgradeScript.sol";
import {UpgradeLidoARMMainnetScript} from "./mainnet/003_UpgradeLidoARMScript.sol";
import {UpdateCrossPriceMainnetScript} from "./mainnet/004_UpdateCrossPriceScript.sol";
import {DeployCoreHoleskyScript} from "./holesky/001_DeployCoreScript.sol";
import {UpgradeHoleskyScript} from "./holesky/002_UpgradeScript.sol";

Expand Down Expand Up @@ -60,6 +61,7 @@ contract DeployManager is Script {
_runDeployFile(new DeployCoreMainnetScript());
_runDeployFile(new UpgradeMainnetScript(this));
_runDeployFile(new UpgradeLidoARMMainnetScript());
_runDeployFile(new UpdateCrossPriceMainnetScript());
} else if (block.chainid == 17000) {
_runDeployFile(new DeployCoreHoleskyScript());
_runDeployFile(new UpgradeHoleskyScript(this));
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/mainnet/003_UpgradeLidoARMScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract UpgradeLidoARMMainnetScript is AbstractDeployScript {
GovProposal public govProposal;

string public constant override DEPLOY_NAME = "003_UpgradeLidoARMScript";
bool public constant override proposalExecuted = false;
bool public constant override proposalExecuted = true;

Proxy lidoARMProxy;
Proxy capManProxy;
Expand Down
35 changes: 35 additions & 0 deletions script/deploy/mainnet/004_UpdateCrossPriceScript.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.23;

import "forge-std/console.sol";

import {GovProposal, GovSixHelper} from "contracts/utils/GovSixHelper.sol";
import {AbstractDeployScript} from "../AbstractDeployScript.sol";

contract UpdateCrossPriceMainnetScript is AbstractDeployScript {
using GovSixHelper for GovProposal;

GovProposal public govProposal;

string public constant override DEPLOY_NAME = "004_UpdateCrossPriceScript";
bool public constant override proposalExecuted = false;

function _execute() internal override {}

function _buildGovernanceProposal() internal override {
govProposal.setDescription("Update Cross Price for Lido ARM");

uint256 newCrossPrice = 0.9999 * 1e36;

govProposal.action(deployedContracts["LIDO_ARM"], "setCrossPrice(uint256)", abi.encode(newCrossPrice));

_fork();
}

function _fork() internal override {
if (this.isForked()) {
govProposal.simulate();
}
}
}
2 changes: 1 addition & 1 deletion test/fork/LidoFixedPriceMultiLpARM/Deposit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ contract Fork_Concrete_LidoARM_Deposit_Test_ is Fork_Shared_Test_ {
);

uint256 expectedTotalSupplyBeforeDeposit = expectTotalAssetsBeforeSwap;
uint256 expectTotalAssetsBeforeDeposit = expectTotalAssetsBeforeSwap - 2
uint256 expectTotalAssetsBeforeDeposit = expectTotalAssetsBeforeSwap - 1
// steth in discounted to the cross price
+ ((swapInAmount * 0.999e36) / 1e36)
// weth out discounted by the buy price
Expand Down
12 changes: 6 additions & 6 deletions test/smoke/LidoARMSmokeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
assertEq(address(lidoARM.weth()), Mainnet.WETH, "WETH");
assertEq(lidoARM.liquidityAsset(), Mainnet.WETH, "liquidity asset");
assertEq(lidoARM.claimDelay(), 10 minutes, "claim delay");
assertEq(lidoARM.crossPrice(), 0.99985e36, "cross price");
assertEq(lidoARM.crossPrice(), 0.9999e36, "cross price");

assertEq(capManager.accountCapEnabled(), false, "account cap enabled");
assertEq(capManager.operator(), Mainnet.ARM_RELAYER, "Operator");
Expand All @@ -71,10 +71,10 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {

function test_swap_exact_weth_for_steth() external {
// trader buys stETH and sells WETH, the ARM sells stETH at a
// 0.5 bps discount
_swapExactTokensForTokens(weth, steth, 0.99995e36, 10 ether);
// 1 bps discount
_swapExactTokensForTokens(weth, steth, 0.9999e36, 10 ether);
// 1.5 bps discount
_swapExactTokensForTokens(weth, steth, 0.99985e36, 100 ether);
_swapExactTokensForTokens(weth, steth, 0.9999e36, 100 ether);
}

function test_swapTokensForExactTokens() external {
Expand Down Expand Up @@ -108,7 +108,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
expectedOut = amountIn * price / 1e36;

vm.prank(Mainnet.ARM_RELAYER);
uint256 sellPrice = price < 0.99965e36 ? 0.99985e36 : price + 2e32;
uint256 sellPrice = price < 0.9997e36 ? 0.9999e36 : price + 2e32;
lidoARM.setPrices(price, sellPrice);
}
// Approve the ARM to transfer the input token of the swap.
Expand Down Expand Up @@ -145,7 +145,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
expectedIn = amountOut * 1e36 / price + 3;

vm.prank(Mainnet.ARM_RELAYER);
uint256 sellPrice = price < 0.99965e36 ? 0.99985e36 : price + 2e32;
uint256 sellPrice = price < 0.9997e36 ? 0.9999e36 : price + 2e32;
lidoARM.setPrices(price, sellPrice);
}
// Approve the ARM to transfer the input token of the swap.
Expand Down
Loading