Skip to content

Library to interact with Gnosis Safe from Foundry Scripts

Notifications You must be signed in to change notification settings

Lagrange-Labs/forge-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forge-safe: Gnosis Safe batch builder

Forge Safe lets Forge users build Gnosis Safe batch transactions using Forge scripting in Solidity. Forge Safe builds a collection of encoded transactions, then sends them to the Gnosis Safe Transaction Service uses surl.

The goal of this tool is to allow users to quickly build, validate and version control complex Safe batches as code.

Inspired by ape-safe and Olymsig

Installation

forge install ind-igo/forge-safe

Usage

Steps:

  1. In your .env file
    • Set CHAIN to the name of the chain your Safe is on
    • Set WALLET_TYPE with LOCAL or LEDGER depending on your wallet
  2. Import BatchScript.sol into your Forge script
  3. Call addToBatch() for each encoded call
  4. After all encoded txs have been added, call executeBatch() with your Safe address and whether to send the transaction
  5. ???
  6. Profit
import {BatchScript} from "forge-safe/BatchScript.sol";

...

function run(bool send_) public {
        string memory gm = "gm";
        address greeter = 0x1111;

        bytes memory txn = abi.encodeWithSelector(
            Greeter.greet.selector,
            gm
        );
        addToBatch(greeter, 0, txn);

        executeBatch(safe, send_);
}

About

Library to interact with Gnosis Safe from Foundry Scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 86.1%
  • Shell 13.9%