Skip to content

Commit

Permalink
fix: use -unlocked keywork to broadcast & impersonate
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-ux committed Sep 30, 2024
1 parent 8bfe317 commit 06a02e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
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) --private-key ${DEPLOYER_PRIVATE_KEY} --broadcast --slow -vvvv
@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 -vvvv
Expand Down
9 changes: 5 additions & 4 deletions script/deploy/AbstractDeployScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ abstract contract AbstractDeployScript is Script {
/// @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,12 +71,11 @@ abstract contract AbstractDeployScript is Script {
}

if (this.isForked()) {
deployer = Mainnet.INITIAL_DEPLOYER;
if (tenderlyTestnet) {
deployer = vm.rememberKey(uint256(1));
console.log("Deploying on Tenderly testnet with deployer: %s", deployer);
vm.startBroadcast(deployer);
} else {
deployer = Mainnet.INITIAL_DEPLOYER;
console.log("Running script on mainnet fork impersonating: %s", deployer);
vm.startPrank(deployer);
}
Expand All @@ -91,7 +90,9 @@ abstract contract AbstractDeployScript is Script {

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

function _fork() internal override {
vm.startPrank(Mainnet.ARM_MULTISIG);
if (tenderlyTestnet) {
vm.startBroadcast(Mainnet.ARM_MULTISIG);
} else {
vm.startPrank(Mainnet.ARM_MULTISIG);
}

if (lidoARMProxy == Proxy(0x0000000000000000000000000000000000000000)) {
revert("Lido ARM proxy not found");
Expand Down

0 comments on commit 06a02e6

Please sign in to comment.