Skip to content

Commit

Permalink
Deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
aviggiano committed Feb 9, 2025
1 parent b327a1e commit bde3df8
Show file tree
Hide file tree
Showing 24 changed files with 1,063 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ For example, a 3/5 Safe (3 owners out of 5 must sign in order to execute a trans
- 2/2/3 Safe where two of the owners are AI agents that can Safe manage funds but only if the recipient is the Safe account.
- 2/3/5 Safe for a DAO treasury where at two owners can execute approved governance proposals, submit emergency transactions, but need 3 signatures for token transfers, or protocol parameter changes

## Deployments

| Network | Address |
| ------- | ------- |
| Ethereum | [`0xF22950636786102A678B4d821a810C865E28cD76`](https://etherscan.io/address/0xF22950636786102A678B4d821a810C865E28cD76) |
| Arbitrum | [`0xF22950636786102A678B4d821a810C865E28cD76`](https://arbiscan.io/address/0xF22950636786102A678B4d821a810C865E28cD76) |
| Optimism | [`0xF22950636786102A678B4d821a810C865E28cD76`](https://optimistic.etherscan.io/address/0xF22950636786102A678B4d821a810C865E28cD76) |
| Celo | [`0xF22950636786102A678B4d821a810C865E28cD76`](https://celoscan.io/address/0xF22950636786102A678B4d821a810C865E28cD76) |
| Linea | [`0xF22950636786102A678B4d821a810C865E28cD76`](https://lineascan.build/address/0xF22950636786102A678B4d821a810C865E28cD76) |

## How it works

1. Setup: After deploying the Safe, the `RestrictedActionsGuard` must be set up with a chosen Guard threshold.
Expand Down Expand Up @@ -119,8 +129,6 @@ safe.execTransaction(
);
```

## Deployments

## Alternatives

Another approach to implementing restricted actions on a Safe is using the [Zodiac Roles Modifier](https://github.com/gnosisguild/zodiac-modifier-roles) by Gnosis Guild. This modifier enables role-based access control, allowing specific roles to call pre-approved functions with defined parameters.
Expand Down
72 changes: 72 additions & 0 deletions broadcast/Deploy.s.sol/1/run-1739137291.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/1/run-1739144371.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/1/run-latest.json

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions broadcast/Deploy.s.sol/10/run-1739138015.json

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions broadcast/Deploy.s.sol/10/run-1739144190.json

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions broadcast/Deploy.s.sol/10/run-latest.json

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions broadcast/Deploy.s.sol/42161/run-1739142439.json

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions broadcast/Deploy.s.sol/42161/run-1739144304.json

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions broadcast/Deploy.s.sol/42161/run-latest.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-1739142516.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-1739142707.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-1739143159.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-1739143254.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-1739143848.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/42220/run-latest.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions broadcast/Deploy.s.sol/59144/run-1739137786.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/59144/run-1739143923.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/Deploy.s.sol/59144/run-latest.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,23 @@ src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.23"
optimizer = true
optimizer_runs = 200
evm_version = 'paris'

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options


[rpc_endpoints]
mainnet = "${MAINNET_RPC_URL}"
optimism = "${OPTIMISM_RPC_URL}"
arbitrum = "${ARBITRUM_RPC_URL}"
celo = "${CELO_RPC_URL}"
linea = "${LINEA_RPC_URL}"

[etherscan]
mainnet = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISM}" }
arbitrum = { key = "${API_KEY_ARBITRUM}" }
celo = { key = "${API_KEY_CELO}" }
linea = { key = "${API_KEY_LINEA}" }
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
@solady=lib/solady
@src=src
@test=test
@script=script
20 changes: 20 additions & 0 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {console, Script} from "forge-std/Script.sol";
import {ICreate2Deployer} from "@script/interfaces/ICreate2Deployer.sol";
import {RestrictedActionsGuard} from "@src/RestrictedActionsGuard.sol";

contract DeployScript is Script {
ICreate2Deployer create2Deployer = ICreate2Deployer(0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2);

function run() public {
vm.startBroadcast();
console.log("[RestrictedActionsGuard] deploying...");

create2Deployer.deploy(0, bytes32(0), type(RestrictedActionsGuard).creationCode);
console.log("[RestrictedActionsGuard] done");

vm.stopBroadcast();
}
}
7 changes: 7 additions & 0 deletions script/interfaces/ICreate2Deployer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: MIT
// Further information: https://eips.ethereum.org/EIPS/eip-1014
pragma solidity ^0.8.9;

interface ICreate2Deployer {
function deploy(uint256 value, bytes32 salt, bytes memory code) external;
}
1 change: 1 addition & 0 deletions src/RestrictedActionsGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {ExtendedSignatureDecoder} from "@src/ExtendedSignatureDecoder.sol";
/// - `mask` is 0x00 => wildcard (allow any byte)
/// @dev Invariants:
/// - threshold <= guardThreshold <= ownersCount
/// - safe.executeTransaction is successful if signers.length >= guardThreshold OR calldata is valid wrt target/pattern/match
contract RestrictedActionsGuard is BaseGuard, ExtendedSignatureDecoder {
using EnumerableSet for EnumerableSet.AddressSet;

Expand Down

0 comments on commit bde3df8

Please sign in to comment.