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

Handler Tenderly testnet #26

Merged
merged 6 commits into from
Oct 1, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ deploy:
@forge script script/deploy/DeployManager.sol --rpc-url $(PROVIDER_URL) --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --slow --verify -vvvv

deploy-testnet:
@forge script script/deploy/DeployManager.sol --rpc-url $(TESTNET_URL) --broadcast --slow -vv
@forge script script/deploy/DeployManager.sol --rpc-url $(TESTNET_URL) --broadcast --slow --unlocked -vvvv

deploy-holesky:
@forge script script/deploy/DeployManager.sol --rpc-url $(HOLESKY_URL) --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --slow --verify -vvv
Expand Down
20 changes: 13 additions & 7 deletions script/deploy/AbstractDeployScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ abstract contract AbstractDeployScript is Script {
deployedContracts[name] = addr;
}

function isForked() public returns (bool) {
return isTenderlyRpc() || vm.isContext(VmSafe.ForgeContext.ScriptDryRun)
function isForked() public view returns (bool) {
return tenderlyTestnet || vm.isContext(VmSafe.ForgeContext.ScriptDryRun)
|| vm.isContext(VmSafe.ForgeContext.TestGroup);
}

/// @notice Detect if the RPC URL is a tendrly testnet, by trying to call a specific tenderly method on rpc.
/// @dev if the call success, it means we are on a tenderly testnet, otherwise we arn't.
function isTenderlyRpc() public returns (bool) {
// Try to give ethers to "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf" which is the address for pk = 0x0....01
try vm.rpc("tenderly_setBalance", "[[\"0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf\"], \"0xDE0B6B3A7640000\"]") {
// Try to give ethers to "ARM_MULTISIG"
try vm.rpc("tenderly_setBalance", "[[\"0xC8F2cF4742C86295653f893214725813B16f7410\"], \"0xDE0B6B3A7640000\"]") {
tenderlyTestnet = true;
return true;
} catch {
Expand All @@ -71,8 +71,12 @@ abstract contract AbstractDeployScript is Script {
}

if (this.isForked()) {
deployer = vm.rememberKey(uint256(1));
deployer = Mainnet.INITIAL_DEPLOYER;
if (tenderlyTestnet) {
// Give enough ethers to deployer
vm.rpc(
"tenderly_setBalance", "[[\"0x0000000000000000000000000000000000001001\"], \"0xDE0B6B3A7640000\"]"
);
console.log("Deploying on Tenderly testnet with deployer: %s", deployer);
vm.startBroadcast(deployer);
} else {
Expand All @@ -90,12 +94,14 @@ abstract contract AbstractDeployScript is Script {

if (this.isForked()) {
if (tenderlyTestnet) {
_buildGovernanceProposal();
vm.stopBroadcast();
_fork();
} else {
vm.stopPrank();
_buildGovernanceProposal();
_fork();
}
_buildGovernanceProposal();
_fork();
} else {
vm.stopBroadcast();
}
Expand Down
14 changes: 11 additions & 3 deletions script/deploy/mainnet/003_UpgradeLidoARMScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ contract UpgradeLidoARMMainnetScript is AbstractDeployScript {
function _buildGovernanceProposal() internal override {}

function _fork() internal override {
console.log("Executing fork script against a fork as: %s", Mainnet.ARM_MULTISIG);
vm.startPrank(Mainnet.ARM_MULTISIG);
if (tenderlyTestnet) {
vm.startBroadcast(Mainnet.ARM_MULTISIG);
} else {
console.log("Broadcasting fork script to Tenderly as: %s", Mainnet.ARM_MULTISIG);
vm.startBroadcast(Mainnet.ARM_MULTISIG);
}

if (lidoARMProxy == Proxy(0x0000000000000000000000000000000000000000)) {
revert("Lido ARM proxy not found");
Expand Down Expand Up @@ -123,6 +127,10 @@ contract UpgradeLidoARMMainnetScript is AbstractDeployScript {

console.log("Finished running initializing Lido ARM as ARM_MULTISIG");

vm.stopPrank();
if (tenderlyTestnet) {
vm.stopBroadcast();
} else {
vm.stopPrank();
}
}
}
6 changes: 6 additions & 0 deletions src/contracts/utils/Addresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ library Mainnet {
address public constant TREASURY = 0x6E3fddab68Bf1EBaf9daCF9F7907c7Bc0951D1dc;

// Multisig and EOAs
address public constant INITIAL_DEPLOYER = address(0x1001);
address public constant GOV_MULTISIG = 0xbe2AB3d3d8F6a32b96414ebbd865dBD276d3d899;
address public constant ARM_MULTISIG = 0xC8F2cF4742C86295653f893214725813B16f7410;
address public constant OETH_RELAYER = 0x4b91827516f79d6F6a1F292eD99671663b09169a;
Expand All @@ -39,6 +40,7 @@ library Mainnet {

library Holesky {
// Multisig and EOAs
address public constant INITIAL_DEPLOYER = 0x1b94CA50D3Ad9f8368851F8526132272d1a5028C;
address public constant RELAYER = 0x3C6B0c7835a2E2E0A45889F64DcE4ee14c1D5CB4;

// Tokens
Expand Down Expand Up @@ -82,6 +84,7 @@ contract AddressResolver {
resolver[MAINNET]["LIDO_ARM"] = Mainnet.LIDO_ARM;

// Test accounts
resolver[MAINNET]["INITIAL_DEPLOYER"] = address(0x1001);
resolver[MAINNET]["WHALE_OETH"] = 0x8E02247D3eE0E6153495c971FFd45Aa131f4D7cB;

///// Holesky //////
Expand All @@ -96,6 +99,9 @@ contract AddressResolver {
// Contracts
resolver[HOLESKY]["OETH_VAULT"] = Holesky.OETH_VAULT;
resolver[HOLESKY]["OETH_ARM"] = Mainnet.OETH_ARM;

// Test accounts
resolver[HOLESKY]["INITIAL_DEPLOYER"] = Holesky.INITIAL_DEPLOYER;
}

function resolve(string memory name) public view returns (address resolved) {
Expand Down