Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Temp fix, hardcode Portal addr
  • Loading branch information
anikaraghu committed Jun 9, 2023
commit 7a96dc0da25cdc87a593a2b02dccbfc76279ea5c
14 changes: 8 additions & 6 deletions script/upgrade/SafeBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IGnosisSafe, Enum } from "@eth-optimism-bedrock/scripts/interfaces/IGno
import { EnhancedScript } from "@eth-optimism-bedrock/scripts/universal/EnhancedScript.sol";
import { GlobalConstants } from "@eth-optimism-bedrock/scripts/universal/GlobalConstants.sol";
import { ProxyAdmin } from "@eth-optimism-bedrock/contracts/universal/ProxyAdmin.sol";
import "script/deploy/Utils.sol";
// import "script/deploy/Utils.sol";

/**
* @title SafeBuilder
Expand Down Expand Up @@ -105,14 +105,15 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
* all of the signers have used this script.
*/
function _run(address _safe) public returns (bool) {
Utils addressUtils = new Utils();
Utils.AddressesConfig memory addressesCfg = addressUtils.readAddressesFile();
// Utils addressUtils = new Utils();
// Utils.AddressesConfig memory addressesCfg = addressUtils.readAddressesFile();
address optimismPortal = 0x805fbEDB43E814b2216ce6926A0A19bdeDb0C8Cd;

IGnosisSafe safe = IGnosisSafe(payable(_safe));
bytes memory data = buildCalldata();

// Compute the safe transaction hash
bytes32 hash = _getTransactionHash(_safe, addressesCfg.OptimismPortalProxy);
bytes32 hash = _getTransactionHash(_safe, optimismPortal);

// Send a transaction to approve the hash
safe.approveHash(hash);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make it so we only approve if the given owner hasn't already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed this would be good to save gas 👍 I'll address this as a follow up

Expand All @@ -138,7 +139,7 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
bytes memory signatures = buildSignatures();

bool success = safe.execTransaction({
to: addressesCfg.OptimismPortalProxy,
to: optimismPortal,
value: 0,
data: data,
operation: Enum.Operation.Call,
Expand All @@ -156,7 +157,7 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
_data: abi.encodeCall(
safe.execTransaction,
(
addressesCfg.OptimismPortalProxy,
optimismPortal,
0,
data,
Enum.Operation.Call,
Expand Down Expand Up @@ -206,3 +207,4 @@ abstract contract SafeBuilder is EnhancedScript, GlobalConstants {
return signatures;
}
}