gnosis safe tx builder

Overview

Ape Safe: Gnosis Safe tx builder

Ape Safe allows you to iteratively build complex multi-step Gnosis Safe transactions and safely preview their side effects from the convenience of a locally forked mainnet environment.

Installation

pip install -U ape-safe

Quickstart

brownie console --network mainnet-fork
from ape_safe import ApeSafe
safe = ApeSafe('ychad.eth')

dai = safe.contract('0x6B175474E89094C44Da98b954EedeAC495271d0F')
vault = safe.contract('0x19D3364A399d251E894aC732651be8B0E4e85001')

amount = dai.balanceOf(safe.account)
dai.approve(vault, amount)
vault.deposit(amount)

safe_tx = safe.multisend_from_receipts()
safe.preview(safe_tx)
safe.post_transaction(safe_tx)

See Documentation for more examples and full reference.

Comments
  • Question: Is there a workflow to sign the safe tx using a ledger based account?

    Question: Is there a workflow to sign the safe tx using a ledger based account?

    Considering the security focus of Gnosis Safes it seems counterproductive to require the private key to reside on the machine where the ape-safe tools are used.

    opened by jo-tud 6
  • When invoking method on contract I receive ValueError: eth_sendTransaction does not exist

    When invoking method on contract I receive ValueError: eth_sendTransaction does not exist

    I am trying to have a gnosis safe invoke the mint function on an ERC20 to which it has the permissions to do so.

    Below is my code in which I follow the way presented in the quickstart of the documentation.

    When I run this code, it errors out at ovl.mint with the error ValueError: The method eth_sendTransaction does not exist/is not available

    def main():    
      gov = dotenv_values()['GOVERNANCE']    
      safe = ApeSafe(gov)            
      ovl = safe.contract("0xfa474A313BDBF69E287dbef667e2f626ea2574Df") # Must have a checksummed address          
      ovl.mint("0xA600AdF7CB8C750482a828712849ee026446aA66", 1e18) # method takes (address,uint) 
    

    When I run this code, I get this stack trace at ovl.mint()

      File "brownie/_cli/run.py", line 51, in main
        return_value, frame = run(
      File "brownie/project/scripts.py", line 110, in run
        return_value = f_locals[method_name](*args, **kwargs)
      File "./scripts/token/mint.py", line 27, in main
        ovl.mint(to, amt)
      File "brownie/network/contract.py", line 1861, in __call__
        return self.transact(*args)
      File "brownie/network/contract.py", line 1734, in transact
        return tx["from"].transfer(
      File "brownie/network/account.py", line 644, in transfer
        receipt, exc = self._make_transaction(
      File "brownie/network/account.py", line 752, in _make_transaction
        exc = VirtualMachineError(e)
      File "brownie/exceptions.py", line 96, in __init__
        raise ValueError(exc["message"]) from None
    ValueError: The method eth_sendTransaction does not exist/is not available
    
    opened by realisation 1
  • Cannot find module after quickstart instructions

    Cannot find module after quickstart instructions

    I followed these https://safe.ape.tax/quickstart.html instructions and when I try to run scripts or a brownie console to import ApeSafe from ape_safe, it gives me an error saying there is no module named ape_safe.

    Python version in the brownie console is 3.8.9 Python3 version is 3.9.10 Python version is 2.7.18 Brownie version 1.17.2 Pip3 version is 22.2.2 Pipx version is 1.0.0 Pip version is 22.0.4

    Operating system is MacOS Monterey 12.2.1

    opened by realisation 1
  • non descriptive error when passing non checksummed address

    non descriptive error when passing non checksummed address

      File "./ape_safe.py", line 56, in contract
        return Contract(address, owner=self.account)
      File "brownie/network/contract.py", line 916, in __init__
        address_or_alias = address_or_alias.strip()
    AttributeError: 'NoneType' object has no attribute 'strip'
    
    opened by gosuto-inzasheru 1
  • Can't sign tx to test if I am not part of the ms

    Can't sign tx to test if I am not part of the ms

    CMO allowed me to test a tx and sign even when I was not an owner of a delegate of the ms. With ape-safe I get:

    ApiError: Error posting transaction: b'{"nonFieldErrors":["Sender=0x0 is not an owner or delegate. Current owners=[\'0x0\', \'0x0\', \'0x6F2A8Ee9452ba7d336b3fba03caC27f7818AeAD6\']. Delegates=[]"]}'

    At the beginning I thought it was a gnosis upgrade, but I just run a tx with ape-safe installed and I could sign to test without issues.

    I guess ms.preview(tx) is not doing the same thing as estimate_safe_tx(safe_tx)

    opened by poolpitako 1
  • Installation fails

    Installation fails

    Trying to install with pip install -U ape-safe fails with the following error:

    ERROR: trie 2.0.0a5 has requirement typing-extensions<4,>=3.7.4, but you'll have typing-extensions 4.2.0 which is incompatible.
    ERROR: eth-brownie 1.19.0 has requirement requests==2.27.1, but you'll have requests 2.28.0 which is incompatible.
    

    Using linux and python 3.8.10.

    Maybe related to issue #27?

    opened by bingen 0
  • simulate all pending txs before preview

    simulate all pending txs before preview

    problem

    it feels bad when a tx in the queue rugs a tx you have carefully crafted.

    solution

    add a flag to preview to simulate all the txs in the queue, so you arrive at a more correct state.

    good first issue 
    opened by banteg 0
  • feat: add Trezor eip-712 signing support

    feat: add Trezor eip-712 signing support

    Trezor T now has support for EIP-712 clear signing; this adds Trezor + EIP-712 sig support in Ape Safe

    Changes (in sign_with_trezor()):

    • added EIP-712 support
    • added force_eth_sign param to force use of eth_sign instead of EIP-712 signatures
    • sign_with_trezor() will now prefer EIP-712 signatures if the connected Trezor is compatible (based on model + fw version). Otherwise (or if force_eth_sign is truthy), it'll stick with eth_sign signatures.

    This might need another update if and when Trezor adds EIP-712 signing support in Trezor One (client.features.model == "1") -- plus, it seems like Trezor is planning on only having blind-signing support on the T1 (trezor/trezor-firmware#1970), so a bit of extra work might be needed for future T1 support

    Tested on Trezor T with fw version v2.4.3; both EIP-712 and eth_sign signatures work fine.

    opened by zhongfu 0
  • feat: add Trezor signing support (through trezorlib)

    feat: add Trezor signing support (through trezorlib)

    Added ability to create eth_sign SafeTx signatures with trezorlib. Adds new function sign_with_trezor(safe_tx, derivation_path, use_passphrase)

    Passphrase support is kind of rudimentary; I believe it might not work on the Trezor One because you can't enter a passphrase on-device with it. We could probably do on-host passphrase input though. Otherwise, it defaults to no passphrase (and skips any passphrase prompts), which will probably work on a T1

    Tested w/ a Trezor T on fw v2.4.2.

    (also, worth noting that EIP-712 support is now in master for TT; we can probably add signTypedData support too)

    (would also appreciate if someone with a T1 could test it out)

    opened by zhongfu 0
  • feat: hardware wallet support via frame signer

    feat: hardware wallet support via frame signer

    Add ability to sign Safe transactions using Ledger, Trezor and Lattice1 via Frame.

    Tested on Ethereum Mainnet with Ledger Nano X.

    New API:

    • get_signer()
    • sign_with_frame(safe_tx)
    • post_signature(safe_tx, signature_
    • pending_transactions
    • confirmations_to_signatures(confirmations)
    • execute_transaction

    Some specific combinations I want tested:

    • [ ] safe on any network but eth mainnet which has a ledger as owner (ledger doesn't support eip155 and i want to see if i implemented the fix for it correctly)
    • [ ] safe on any network with any trezor model as owner
    • [ ] safe on any network with lattice1 as owner
    opened by banteg 0
  • May not work for some installation with the trezor from `0.13.0`

    May not work for some installation with the trezor from `0.13.0`

    The problem is in simple-rlp dependency introduced by trezor, see the issue.

    <...>
        class HashableRLP(rlp.Serializable):
    AttributeError: module 'rlp' has no attribute 'Serializable'
    

    Possible workaround ~~for those who doesn't rely on trezor~~:

    rm -r .direnv/python-3.9.16/lib/python3.9/site-packages/rlp-2.0.1.dist-info
    rm -r .direnv/python-3.9.16/lib/python3.9/site-packages/rlp
    pip install rlp==2.0.1
    

    By the way, simple running pip install ape-safe from scratch does the thing because of order of packages installation.

    opened by madlabman 0
  • feat: support renaming of `Safe.get_contract` to `Safe.contract` in `safe-eth-py>=4.4.0`

    feat: support renaming of `Safe.get_contract` to `Safe.contract` in `safe-eth-py>=4.4.0`

    function was renamed in safe-eth-py>=v4.4.0 (https://github.com/safe-global/safe-eth-py/pull/339/commits/95f6dab52cbf6a6c7462158538593f51bc6b62e0), which now collides with our ApeSafe.contract

    solves #43

    opened by gosuto-inzasheru 0
  • chore: update safe global api urls

    chore: update safe global api urls

    old docs here, but urls redirect to the new ones: https://docs.gnosis-safe.io/backend/available-services#safe-transaction-service

    rinkeby has been deprecated

    opened by gosuto-inzasheru 0
  • Most recent version of safe-eth-py isn't working with addresses

    Most recent version of safe-eth-py isn't working with addresses

    Using ape-safe 0.5.1 with safe-eth-py="4.3.0" and above or 0.6.0 with safe-eth-py="^4.5.0" isn't working.

    Here is the error.

    File "brownie/_cli/run.py", line 51, in main
        return_value, frame = run(
      File "brownie/project/scripts.py", line 110, in run
        return_value = f_locals[method_name](*args, **kwargs)
      File "./scripts/33_test_ape_safe.py", line 10, in main
        safe_tx = safe.multisend_from_receipts()
      File "ape_safe.py", line 115, in multisend_from_receipts
        data = MultiSend(self.multisend, self.ethereum_client).build_tx_data(txs)
      File "gnosis/safe/multi_send.py", line 199, in __init__
        assert fast_is_checksum_address(address), (
    AssertionError: EthereumClient for url=http://127.0.0.1:8545 proxy factory address not valid
    Terminating local RPC client...
    
    opened by pandadefi 1
  • parameter flip in gnosis py

    parameter flip in gnosis py

    https://github.com/safe-global/safe-eth-py/commit/8848f1660f6a04995ebb808f4cc946bd060915c2#diff-8a8473acf2213f63824bdb6022b690acfd1fab752f657301175b01c2cd9e0cf0

    opened by banteg 0
Releases(v0.5.0)
  • v0.5.0(Dec 16, 2021)

    What's Changed

    • Add execute_transaction_with_frame by @OwlOfMoistness in https://github.com/banteg/ape-safe/pull/21
    • feat: add Trezor eip-712 signing support by @zhongfu in https://github.com/banteg/ape-safe/pull/22

    New Contributors

    • @OwlOfMoistness made their first contribution in https://github.com/banteg/ape-safe/pull/21

    Full Changelog: https://github.com/banteg/ape-safe/compare/v0.4.0...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Nov 30, 2021)

  • v0.3.2(Nov 10, 2021)

    • hardware wallet support via frame
    • submit signatures to transaction service
    • retrieve pending transactions from transaction service
    • execute signed transactions
    • convert confirmations to signatures
    • expanded documentation about signing
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Sep 13, 2021)

  • v0.2.0(Jul 22, 2021)

    • add support for safe contracts 1.3.0
    • switch to multicall 1.3.0 call only
    • support multiple networks
    • autodetect transaction service from chain id
    Source code(tar.gz)
    Source code(zip)
Owner
core dev, yearn.finance
Autofilter with imdb bot || broakcast , imdb poster and imdb rating

LuciferMoringstar_Robot How To Deploy Video Subscribe YouTube Channel Added Features Imdb posters for autofilter. Imdb rating for autofilter. Custom c

Muhammed 127 Dec 29, 2022
Telegram Bot to save Posts or Files that can be Accessed via Special Links

OKAERI-FILE Bot Telegram untuk menyimpan Posting atau File yang dapat Diakses melalui Link Khusus. Jika Anda memerlukan tambahan module lagi dalam rep

Wahyusaputra 5 Aug 04, 2022
CnCL - CnCLess it's an Easy to deploy Botnet without CnC/C2

CnCL CnCLess it's an Easy to deploy Botnet without CnC/C2, Harder to track and t

ZSendokame 2 Jan 10, 2022
A simple Discord Bot that uses the free CryptoCompare API to display cryptocurrency prices

What is this? This is a simple Discord Bot coded in Python that uses the free CryptoCompare API to display cryptocurrency prices Download Use git to c

Kevin 10 Apr 17, 2022
A Telegram bot to download posts, videos, reels, IGTV and a user profile picture from Instagram!

Telegram Bot A telegram bot to download media from Instagram! No API Key or Login Needed! Requirements You must have python installed (of course) You

Simon Farah 2 Apr 10, 2022
A small script to migrate or synchronize users & groups from Okta to AWS SSO

aws-sso-sync-okta A small script to migrate or synchronize users & groups from Okta to AWS SSO Changelog Version Remove hardcoded values on variables

Paul 4 Feb 11, 2022
Discord rich-presence implementation for VALORANT

not working on v1 anymore in favor of v2, but if there's any big bugs i'll try to fix them valorant-rich-presence-client Discord rich presence extensi

colinh 278 Jan 08, 2023
Snipe fair coin launches. Contact @dannsniper on telegram for whitelist

Pancakeswap-sniper Pancakeswap Sniper bot Full version of Pancakeswap sniping bot used to snipe during fair coin launches. With advanced options and a

36 Nov 01, 2021
Userbot untuk memutar video dan lagu di vcg/os

Userbot untuk memutar video dan lagu di vcg/os

FJ_GAMING 2 Nov 13, 2021
Create custom Vanity URLs for Discord without 30 boosts

CustomVanity - Made by udp#6666 aka Apolo - OpenSource Custom Discord Vanity Creator How To Use Open CustomVanity.py Write your server invite code Wri

apolo 17 Aug 23, 2022
A script to find the people whom you follow, but they don't follow you back

insta-non-followers A script to find the people whom you follow, but they don't follow you back Dependencies: python3 libraries - instaloader, getpass

Ritvik 5 Jul 03, 2022
Apps related to Odoo it's calendar features

calendar Apps related to Odoo it's calendar/appointments features: online_appointment_locations: allow setting an online URL per employee online_appoi

Yenthe Van Ginneken 3 Oct 27, 2022
GTPS Status Bot

Python GTPS Status Bot (BETA) Python GTPS Status Bot Require Python How To Use Download This Source Extract The Zip File Install the requirements (Mod

Lamp 4 Oct 11, 2021
Powerful Telegram bot to countdown to your important events in any group chat.

Powerful Telegram bot to countdown to your important events in any group chat. Live countdown timer.

118 Dec 30, 2022
Simple Telegram bot to confess to your crush this Valentine's Day

Simple Telegram bot to confess to your crush this Valentine's Day! Steps pip install python-telegram-bot Register a Telegram bot & get the token by fo

3 Mar 18, 2022
The community bot for the Python Discord community

Python Utility Bot This project is a Discord bot specifically for use with the Python Discord server. It provides numerous utilities and other tools t

Python Discord 998 Jan 03, 2023
The official Python library for Shodan

shodan: The official Python library and CLI for Shodan Shodan is a search engine for Internet-connected devices. Google lets you search for websites,

John Matherly 2.1k Dec 31, 2022
Indian Space Research Organisation API With Python

ISRO Indian Space Research Organisation API Installation pip install ISRO Usage import isro isro.spacecrafts() # returns spacecrafts data isro.lau

Fayas Noushad 5 Aug 11, 2022
A reddit.com bot that will return reference links from official python documentation site for the standard library.

Python Docs Bot A reddit.com bot that will return documentation links for the library and language reference sections of the python docs website. The

Trevor Miller 2 Sep 14, 2021
Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much more!

Acid's Utilities Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much mo

AcidFilms (Fin Stuart) 3 Nov 19, 2021