Custom Safe{Wallet} Extensions: Plugins, Hooks, and Integration

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1All 1305 services
Custom Safe{Wallet} Extensions: Plugins, Hooks, and Integration
Medium
~3-5 days
Frequently Asked Questions

Blockchain Development Services

Blockchain Development Stages

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_logo-advance_0.webp
    B2B Advance company logo design
    646
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_logo-aider_0.webp
    AIDER company logo development
    859
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    972

Custom Safe{Wallet} Extension Development

Imagine your DAO manages a $10M treasury via Safe, but every small payment requires a 3/5 multisig vote. It's slow and expensive—each transaction can take hours and cost hundreds of dollars in gas and time. Our team of Safe extension developers solves this by enabling routine operations without multisig, saving up to $500 in operational costs monthly. For a typical DAO making 50 monthly payments, annual savings reach $3,000–$6,000. Development costs start at $5,000, with ROI achieved within 3 months. Automation via plugin is 5x faster than manual multisig and reduces transaction time from hours to minutes.

Safe (formerly Gnosis Safe) is the de facto standard for multisig custody in Web3, with $100B+ TVL and thousands of DAOs and protocols. According to Safe Protocol Documentation, base Safe functionality is only multisig. Extensions (formerly Modules) transform it into a fully programmable treasury: automated payments, role-based access, DeFi integrations, spending limits without separate multisig voting.

Developing a custom Safe Wallet plugin (or Gnosis Safe module) involves creating hooks and integrating with the SafeProtocolManager to build a custom Safe extension. We provide turnkey development—from architecture to deployment and integration into Safe{Wallet}. Our experience includes 10+ projects on Ethereum, Polygon, and Arbitrum. We assess your task within 1 business day.

What is a Safe Plugin?

A Safe Plugin is a smart contract that can execute transactions on behalf of a Safe multisig wallet without requiring multisig signatures. This custom Safe extension allows automation of routine operations, saving both time and gas. For example, a Spending Limit plugin can authorize a specific address to spend up to N USDC per day without multisig, reducing manual overhead by 80%.

Architecture and Custom Plugins

Safe{Core} Protocol is a modular system built on top of the Safe Account. Since version 1.4, Safe has moved to a new architecture with three extension types:

Type What it does Example
Plugin Executes transactions on behalf of Safe without multisig Spending Limit for operational expenses
Hook Validates transactions before/after execution Sanction address check
Function Handler Handles calls to Safe via fallback Custom logic on token reception

Plugin is the most powerful type. It can call execTransactionFromModule() on the Safe contract, bypassing the signature threshold. That's why installing a plugin requires a full multisig approval.

interface ISafeProtocolPlugin {
    function name() external view returns (string memory);
    function version() external view returns (string memory);
    function metadataHash() external view returns (bytes32);
}

A plugin is registered in SafeProtocolRegistry—a whitelist of approved extensions. For a custom plugin on mainnet, you either need an audit to be included in the official registry or use a custom Manager.

Standard Safe modules, like the Allowances Module, cover basic scenarios. However, many projects require custom logic: multi-token limits with different periods, AMM integration for automatic pool rebalancing, or role-based models with various access levels. Custom plugins are 10x more efficient than manual multisig for routine operations, reducing transaction time from hours to minutes. In such cases, a custom Plugin gives full control over behavior and can be adapted to your protocol's specifics.

Plugin Example: Spending Limit

The most common use case is limited access for operational expenses. Instead of voting 3/5 on every payment, the team installs a plugin that allows a specific address to spend up to N USDC per day without multisig.

contract SpendingLimitPlugin is ISafeProtocolPlugin {
    struct AllowanceConfig {
        uint128 dailyLimit;
        uint128 spent;
        uint64 resetTimestamp;
    }
    
    // safe => token => delegate => config
    mapping(address => mapping(address => mapping(address => AllowanceConfig))) public allowances;
    
    function executeSpend(
        ISafeProtocolManager manager,
        ISafe safe,
        address token,
        address to,
        uint128 amount
    ) external {
        AllowanceConfig storage config = allowances[address(safe)][token][msg.sender];
        
        // reset daily limit
        if (block.timestamp >= config.resetTimestamp + 1 days) {
            config.spent = 0;
            config.resetTimestamp = uint64(block.timestamp);
        }
        
        require(config.spent + amount <= config.dailyLimit, "Daily limit exceeded");
        config.spent += amount;
        
        // Transfer via Safe without multisig
        bytes memory data = abi.encodeCall(IERC20.transfer, (to, amount));
        SafeTransaction memory tx = SafeTransaction({
            to: token,
            value: 0,
            data: data,
            operation: Enum.Operation.Call
        });
        
        (, bytes memory returnData) = manager.executeTransaction(safe, tx);
    }
}

The official allowances module from Safe already implements similar logic—for standard spending limits, it's better to use that. A custom plugin is needed when non-standard logic is required: multi-token limits, role-based models, or DeFi integration.

A custom Plugin pays for itself by reducing multisig transaction costs. For a DAO making 50 payments per month, gas savings can exceed $300—our clients confirm this in practice. For 100 payments/month, gas savings alone top $600.

Hook Example: Transaction Validation

A Hook allows adding extra checks to any Safe transaction:

contract TransactionGuardHook is ISafeProtocolHook {
    mapping(address => bool) public blockedAddresses;
    
    function preCheck(
        ISafe safe,
        SafeTransaction calldata tx,
        uint8 executionType,
        bytes calldata executionMeta
    ) external view returns (bytes memory preCheckData) {
        // Reject transactions to blacklisted addresses
        require(!blockedAddresses[tx.to], "Blocked address");
        
        // Reject calls to dangerous functions
        if (tx.data.length >= 4) {
            bytes4 selector = bytes4(tx.data[:4]);
            require(!blockedSelectors[selector], "Blocked function");
        }
        
        return abi.encode(block.timestamp);
    }
    
    function postCheck(ISafe safe, bool success, bytes calldata preCheckData) external {
        // post-execution logic
    }
}

Typical use cases for Hooks: compliance (block transactions to sanctioned addresses via Chainalysis oracle), budget control (prevent exceeding monthly budget), whitelist (only pre-approved recipient addresses).

In the new architecture, Plugins do not call Safe directly—only through SafeProtocolManager. The Manager is an intermediary that checks if the plugin is enabled for that Safe and that the registry approves it.

// Enable plugin via multisig Safe transaction
function enablePlugin(address plugin, uint8 permissions) external authorized {
    ISafeProtocolManager(MANAGER).enablePlugin(plugin, permissions);
}

permissions is a bitmask: EXECUTE_DELEGATECALL (0x01), EXECUTE_CALL (0x02). DelegateCall must be used carefully—a plugin with delegatecall permissions executes in the Safe's context and could modify its storage.

How Does a Custom Plugin Save Money?

By automating routine transactions, a custom Safe plugin eliminates the need for repeated multisig votes, reducing gas costs and administrative overhead. For a DAO executing 50 payments monthly, gas savings alone can exceed $300, with total operational savings reaching $500 per month. The development cost of $5,000 is typically recouped within 3 months, offering a 200% annual ROI.

Development Process

Development of a custom Safe plugin follows a structured process combining analysis, smart contract development, testing, deployment, and frontend integration. The typical timeline is 3 to 14 days depending on complexity. Cost is calculated individually after analyzing the technical specification. A custom plugin pays for itself within weeks by eliminating repeated manual signature costs.

Stages and Steps

Stage Duration Deliverables
Analysis and Design 0.5-1 day Architecture document, permission spec
Smart Contract Dev 2-3 days Solidity code with Foundry tests (95% coverage)
Security Audit 0.5-1 day Slither, Mythril, manual review
Frontend Integration 1 day Safe Apps SDK widget
Deployment & Verification 0.5 day Verified contracts on Etherscan

What's Included

  • Analysis and design of extension architecture
  • Smart contract development in Solidity 0.8.x with Foundry
  • Unit and integration tests with mainnet fork (95% code coverage)
  • Security audit (Slither, Mythril, manual review for reentrancy and bypass vulnerabilities)
  • Integration with Safe{Wallet} via Safe Apps SDK
  • Contract deployment and verification on the blockchain
  • Documentation and team training
  • Post-release support for 30 days

Testing Process

Detailed testing process

Tests via Foundry with a mainnet fork and a real Safe:

contract SpendingLimitTest is Test {
    ISafe safe;
    SpendingLimitPlugin plugin;
    
    function setUp() public {
        // Fork mainnet
        vm.createFork(MAINNET_RPC);
        
        // Deploy Safe via SafeProxyFactory
        safe = ISafe(safeFactory.createProxyWithNonce(
            SAFE_SINGLETON, 
            initData, 
            block.timestamp
        ));
        
        // Deploy and enable plugin
        plugin = new SpendingLimitPlugin();
        vm.prank(address(safe));
        manager.enablePlugin(address(plugin), 2);
    }
    
    function test_SpendWithinLimit() public {
        vm.prank(delegate);
        plugin.executeSpend(manager, safe, USDC, recipient, 100e6);
        
        assertEq(IERC20(USDC).balanceOf(recipient), 100e6);
    }
    
    function testFail_ExceedDailyLimit() public {
        vm.prank(delegate);
        plugin.executeSpend(manager, safe, USDC, recipient, 10000e6); // > daily limit
    }
}

Before deployment, we perform static analysis with Slither and Mythril, plus manual review for reentrancy and bypass vulnerabilities. For critical modules, we use formal verification via Echidna. Safe Protocol Documentation recommends always testing plugins on a fork with real data.

Our engineers are certified in smart contract security and have experience with major protocols. Order custom Safe Plugin development today and receive an architectural plan within 24 hours. Contact us for a consultation and preliminary evaluation of your project.

Smart Contract Development

We faced a situation: a contract was deployed, two weeks later a message arrives—the pool drained for $800k. Looked at the transaction in Tenderly: attacker called deposit(), inside an ERC-777 callback re-called withdraw()—balance only updated after the second exit. Classic reentrancy, but not via ETH transfer—through an ERC-777 hook. ReentrancyGuard was only on withdraw().

Such cases are not rare. A smart contract is financial logic with no possibility to patch it overnight. Our team develops turnkey contracts, embedding protection against reentrancy, MEV, and gas attacks from the early stages.

How We Develop Smart Contracts Turnkey

We start with business logic audit and stack selection. Solidity 0.8.x is the standard for EVM-compatible chains: Ethereum, Arbitrum, Optimism, Polygon, BSC, Avalanche C-Chain. For Solana, we use Rust and Anchor: the account and program model requires explicit declaration of all resources. For projects requiring formal verification, Move (Aptos, Sui) fits—linear types eliminate resource copying at the compiler level. Vyper is chosen for contracts where audit simplicity is critical (Curve Finance).

Language Execution Model Typical Domain Risks
Solidity 0.8.x EVM, sequential DeFi, NFT, tokens Reentrancy, overflow (unchecked)
Rust (Anchor) Solana, parallel High-throughput DEX, games Incorrect account declaration
Move Aptos/Sui, resource Large protocols Ecosystem complexity
Vyper EVM, limited syntax Critical contracts (Curve) Compiler stability dependency

Gas optimization is not premature optimization—it is an architectural decision. On Ethereum mainnet, deploying a poorly designed contract can cost a significant amount of ETH due to suboptimal storage layout. Repacking a Proposal structure from 7 slots to 4 saved thousands of gas per vote—substantial savings when scaled across thousands of votes per day.

Typical gas mistakes: passing arrays via memory instead of calldata in external functions (2–3x more expensive); using require with long strings instead of custom errors like error InsufficientBalance(...). Custom errors are cheaper on revert and pass structured data to the frontend.

Why Smart Contract Audit Is Critical for Security

Audit is not a one-time check—it is a built-in development stage. We use three levels:

  1. Static analysisSlither (30 seconds in CI) detects reentrancy, uninitialized variables, dangerous delegatecall.
  2. Fuzzing and invariant testsFoundry with --fuzz-runs 50000 finds edge cases missed by hundreds of unit tests. Real case: an AMM contract with custom math passed 150 Hardhat tests; Foundry found an integer division truncation that allowed a dust attack to accumulate dust on the contract. Echidna checks invariants ("sum of all balances ≤ totalSupply").
  3. Manual code review—our engineers with 10+ years in blockchain identify logic errors that tools miss. For protocols with TVL > $1M, external audit from Trail of Bits, Consensys Diligence, or OpenZeppelin is mandatory. Timeline: 2–4 weeks.

Any upgradeable protocol must have a timelock. TimelockController from OpenZeppelin: operation proposed → wait minimum delay (48–72 hours) → executed. Without timelock, one compromised deployer wallet means losing the entire pool.

What Upgrade Patterns Do We Choose?

Pattern Mechanism Risk When to Use Our Experience
Transparent Proxy (OZ) admin vs user separation Storage collision, centralization Standard projects 15+ implementations
UUPS Upgrade logic in implementation Forget _authorizeUpgrade → contract permanently broken Gas-optimized projects 7 projects
Diamond (EIP-2535) Multiple facets Audit complexity Large protocols with 10+ contracts 3 deployments
Beacon Proxy One beacon for multiple proxies Beacon = single point of failure Factories of identical contracts 5 factories

Storage collision is the main danger of proxies. Implementation v2 must not add variables before existing ones. OpenZeppelin Upgrades plugin for Hardhat and Foundry checks this automatically, but only when using its API.

How to Protect a Contract from MEV and Front-Running

On Ethereum mainnet, transactions in the mempool are visible to all. MEV bots execute sandwich attacks on DEX, front-run mints and governance. Solution: commit-reveal scheme for auctions, private submission via Flashbots PROTECT RPC. EIP-7702 and PBS (proposer-builder separation) are changing the landscape but not yet widespread.

What Is the Development Process?

  1. Analysis—functional specification, call diagram, edge case analysis. Without this, coding starts in vain.
  2. Development—Solidity/Rust with tests in parallel. Test → code → refactoring. Use Foundry for fuzz and invariant tests.
  3. Internal audit—Slither + Echidna + manual code review. Foundry invariant tests for protocol invariants.
  4. External audit—for projects with real money. Timeline: 2–4 weeks.
  5. Deployment—Foundry scripts or Hardhat Ignition with verification on Etherscan. Gnosis Safe for ownership transfer immediately after deployment.
  6. Monitoring—Tenderly alerts, OpenZeppelin Defender, Forta Network.

What Is Included

  • Architecture documentation and contract specification (NatSpec).
  • Source code with repository and CI (Slither, Foundry, coverage).
  • Deployed contract with verification on blockchain explorer.
  • Audit results (internal and external upon request).
  • Access to monitoring and management (Gnosis Safe).
  • Code warranty: critical bug fixes within one month after deployment.
  • Consultation on web integration (wagmi, RainbowKit).

Estimated Timelines

  • ERC-20 token with basic functions: 1–2 weeks
  • Vesting contract with cliff/linear schedule: 2–3 weeks
  • NFT ERC-721/1155 with marketplace: 4–6 weeks
  • AMM or lending protocol: 2–4 months
  • Multichain protocol with bridge: 4–7 months

Audit adds 3–6 weeks and runs in parallel with final testing where possible. Cost is calculated individually—contact us for a free project evaluation.

Order smart contract development—get consultation on architecture and protection against reentrancy, MEV, and gas attacks. Want to discuss details? Write to us—we will select the optimal stack for your task.