-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e7f339
commit 981d174
Showing
13 changed files
with
571 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.12; | ||
|
||
interface IMultiSend { | ||
function multiSend(bytes memory transactions) external payable; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.12; | ||
|
||
interface ISafe { | ||
/// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. | ||
/// Note: The fees are always transferred, even if the user transaction fails. | ||
/// @param to Destination address of Safe transaction. | ||
/// @param value Ether value of Safe transaction. | ||
/// @param data Data payload of Safe transaction. | ||
/// @param operation Operation type of Safe transaction. | ||
/// @param safeTxGas Gas that should be used for the Safe transaction. | ||
/// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) | ||
/// @param gasPrice Gas price that should be used for the payment calculation. | ||
/// @param gasToken Token address (or 0 if ETH) that is used for the payment. | ||
/// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). | ||
/// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) | ||
function execTransaction( | ||
address to, | ||
uint256 value, | ||
bytes calldata data, | ||
uint8 operation, | ||
uint256 safeTxGas, | ||
uint256 baseGas, | ||
uint256 gasPrice, | ||
address gasToken, | ||
address payable refundReceiver, | ||
bytes memory signatures | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.12; | ||
|
||
interface ITimelock { | ||
function queuedTransactions(bytes32) external view returns (bool); | ||
|
||
function queueTransaction( | ||
address target, | ||
uint value, | ||
string memory signature, | ||
bytes memory data, | ||
uint eta | ||
) external returns (bytes32); | ||
|
||
function executeTransaction( | ||
address target, | ||
uint value, | ||
string memory signature, | ||
bytes memory data, | ||
uint eta | ||
) external payable returns (bytes memory); | ||
|
||
function cancelTransaction( | ||
address target, | ||
uint value, | ||
string memory signature, | ||
bytes memory data, | ||
uint eta | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.12; | ||
|
||
import {Addresses, Environment, Params, ConfigParser} from "src/utils/ConfigParser.sol"; | ||
|
||
/** | ||
* @notice Struct for deployment information. | ||
* @param name The name of the deployed contract. | ||
* @param deployedTo The address where the contract is deployed. | ||
*/ | ||
struct Deployment { | ||
string name; | ||
address deployedTo; | ||
} | ||
|
||
/** | ||
* @title EOADeployer | ||
* @notice Template for an Externally Owned Account (EOA) deploy script. | ||
*/ | ||
abstract contract EOADeployer is ConfigParser { | ||
/** | ||
* @dev Internal array to store deployment information. | ||
* Intended to be populated by inheriting contracts. | ||
*/ | ||
Deployment[] internal _deployments; | ||
|
||
/** | ||
* @notice Deploys contracts based on the configuration specified in the provided environment file. | ||
* @param envPath The file path to the environment configuration file. | ||
* @return An array of Deployment structs containing information about the deployed contracts. | ||
*/ | ||
function deploy(string memory envPath) public returns (Deployment[] memory) { | ||
// read in config file for environment | ||
( | ||
Addresses memory addrs, | ||
Environment memory env, | ||
Params memory params | ||
) = _readConfigFile(envPath); | ||
|
||
// return deployment info | ||
return _deploy(addrs, env, params); | ||
} | ||
|
||
/** | ||
* @dev Internal function to deploy contracts based on the provided addresses, environment, and parameters. | ||
* @param addrs Struct containing the addresses required for deployment. | ||
* @param env Struct containing the environment settings for deployment. | ||
* @param params Struct containing additional parameters for deployment. | ||
* @return An array of Deployment structs representing the deployed contracts. | ||
*/ | ||
function _deploy(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (Deployment[] memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.12; | ||
|
||
import {Addresses, Environment, Params, ConfigParser} from "src/utils/ConfigParser.sol"; | ||
import {MultisigCall, MultisigCallUtils} from "src/utils/MultisigCallUtils.sol"; | ||
import {SafeTx, EncGnosisSafe} from "src/utils/SafeTxUtils.sol"; | ||
|
||
/** | ||
* @title MultisigBuilder | ||
* @dev Abstract contract for building arbitrary multisig scripts. | ||
*/ | ||
abstract contract MultisigBuilder is ConfigParser { | ||
|
||
using MultisigCallUtils for MultisigCall[]; | ||
|
||
/** | ||
* @dev To be used in _execute() to craft multisig calls. | ||
*/ | ||
MultisigCall[] internal _multisigCalls; | ||
|
||
/** | ||
* @notice Constructs a SafeTx object for a Gnosis Safe to ingest. | ||
* @param envPath The path to the relevant environment configuration file. | ||
* @return A SafeTx struct containing the transaction data to post to the Safe API. | ||
*/ | ||
function execute(string memory envPath) public returns (SafeTx memory) { | ||
// read in config file for relevant environment | ||
( | ||
Addresses memory addrs, | ||
Environment memory env, | ||
Params memory params | ||
) = _readConfigFile(envPath); | ||
|
||
// get calls for Multisig from inheriting script | ||
MultisigCall[] memory calls = _execute(addrs, env, params); | ||
|
||
// encode calls as MultiSend data | ||
bytes memory data = calls.encodeMultisendTxs(); | ||
|
||
// creates and return SafeTx object | ||
// assumes 0 value (ETH) being sent to multisig | ||
return SafeTx({ | ||
to: params.multiSendCallOnly, | ||
value: 0, | ||
data: data, | ||
op: EncGnosisSafe.Operation.DelegateCall | ||
}); | ||
} | ||
|
||
/** | ||
* @notice To be implemented by inheriting contract. | ||
* @param addrs A struct containing the addresses involved in the multisig call. | ||
* @param env A struct containing the environment settings for the multisig call. | ||
* @param params A struct containing the parameters for the multisig call. | ||
* @return An array of MultisigCall objects. | ||
*/ | ||
function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (MultisigCall[] memory); | ||
} |
Oops, something went wrong.