This repository contains smart contracts for Safe Guard implementation, which provides delegate call restrictions for Safe multisig wallets.
The SafeGuard contract is a guard implementation for the Safe (formerly Gnosis Safe) smart contract wallet. It restricts delegate calls to only allowed target addresses, providing an additional layer of security.
This project uses Foundry for development and testing.
forge install
forge test
forge coverage
First, create a .env
file from the example:
cp .env.example .env
Edit .env
with your values:
PRIVATE_KEY=your_private_key_without_0x
RPC_URL=your_rpc_url
Source the environment variables and run the deployment script:
source .env && forge script script/DeploySafeGuard.s.sol:DeploySafeGuard --rpc-url $RPC_URL --broadcast -vvvv
--verify
: Verify contract on Etherscan--chain-id <id>
: Specify network chain ID--gas-price <price>
: Set specific gas price--legacy
: For networks not supporting EIP-1559
source .env && forge script script/DeploySafeGuard.s.sol:DeploySafeGuard --rpc-url $RPC_URL --broadcast --chain-id 11155111 -vvvv
After deployment, the SafeGuard can be:
- Set as a guard on a Safe wallet
- Configured with allowed target addresses for delegate calls
- Managed by the owner to add/remove allowed targets
This project is licensed under the MIT License - see the LICENSE file for details.