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
A AntiChannelBan Telegram Group Bot Open Source

AntiChannelBan This is a Anti Channel Ban Robots delete and ban message sent by channels Deployment Method Heroku 𝚂𝚄𝙿𝙿𝙾𝚁𝚃 CREDIT BrayDen Blaze

✗ BᵣₐyDₑₙ ✗ 14 May 02, 2022
This repository contains modules that extend / modify parts of Odoo ERP

Odoo Custom Addons This repository contains addons that extend / modify parts of Odoo ERP. Addons list account_cancel_permission Only shows the button

Daniel Luque 3 Dec 28, 2022
TwitchAccountMaker - Twitch Account Maker with python

Twitch Account Creator A Twitch Account Creator, Requires Capmonster.cloud Verif

vanis / 1800 0 Jan 20, 2022
Automating whatsapp with python

whatsapp-automation Automating whatsapp with python used on this project pyautogui pywhatkit pyttsx3 SpeechRecognition colorama embedded in python tim

Miguel 60 Nov 21, 2022
Projeto Informações Conta do Instagram - Instagram Account Information Project

VESTA-tools A collection of simple tools that proved to be needed for handling large periodic calculations with the VASP software package. distTotCalc

Thiago Souza 1 Dec 02, 2021
An unofficial API for lyricsfreak.com using django and django rest framework.

An unofficial API for lyricsfreak.com using django and django rest framework.

Hesam Norin 1 Feb 09, 2022
Decryption utility for PGP Whole Disk Encryption

wdepy: Decryption and Inspection for PGP WDE Disks This is a small python tool to inspect and decrypt disk images encrypted with PGP Whole Disk Encryp

Brendan Dolan-Gavitt 17 Oct 07, 2022
With Google Drive API. My computer and my phone are in love now.

Channel trought Google Drive Google Drive API In this case, "Google Drive App" is the program. To install everything you need(has some extra things),

Luis Quiñones Requelme 1 Dec 15, 2021
Asynchronous Python Wrapper for the Ufile API

Ufile.io Asynchronous Python Wrapper for the Ufile API (Unofficial).

Gautam Kumar 16 Aug 31, 2022
Esse script procura qualquer, dados que você queira na wikipedia! Em breve traremos um com dados em toda a internet.

Buscador de dados simples Dependências necessárias Para você poder começar a utilizar esta ferramenta, você vai precisar da dependência "wikipedia", p

Erick Campoy 4 Feb 24, 2022
A telegram bot writen in python for mirroring files on the internet to our beloved Google Drive

[] Mirror Bot This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive. Deploying on Heroku Give Star &

43 Mar 06, 2022
Autofilterv5 With Same more Features

Autofilterv5 With Same more Features ✨ Imbd + Index +.....

Selfie SD 8 Oct 21, 2022
Prabashwara's Pm Bot repository. You can deploy and edit this repository.

Tᴇʟᴇɢʀᴀᴍ Pᴍ Bᴏᴛ | Prabashwara's PM Bot Unmaintained. The new repo of @Pm-Bot is private. (It is no longer based on this source code. The completely re

Rivibibu Prabshwara Ⓒ 2 Jul 05, 2022
Código python para automatizar a junção de arquivos CSV's e salva-los em uma pasta final de destino.

merge_csv Código python para automatizar a junção de arquivos CSV's e salva-los em uma pasta final de destino. Esse projeto é usado pra unir alguns ar

Welder Fariles 1 Jan 12, 2022
Innocent-Bot - A Discord client self-bot for destroying, nuking and causing mischief in servers

Innocent-bot A Discord client self-bot for destroying, nuking and causing mischi

†† 5 Jan 26, 2022
A Rich renderable for viewing Multiple Sequence Alignments in the terminal.

rich-msa A simple module to render colorful Multiple Sequence Alignment with rich in the terminal. 🔧 Installing Install the rich-msa package directly

Martin Larralde 64 Dec 04, 2022
Bavera is an extensive and extendable Python 3.x library for the Discord API

Bavera is an extensive and extendable Python 3.x library for the Discord API. Bavera boasts the following major features: Expressive, functiona

Bavera 1 Nov 17, 2021
Telegram Bot to check covid vaccine slot availability on CoWin site

Cowin Assist Telegram Bot Check the bot here @cowinassistbot. This is a simple Telegram bot to Check slots availability Get an alert when slots become

32 Jun 21, 2022
This is simply code for bitcoin fair value.

About The Project This is a code for bitcoin fair value, its simply exclude bubble data using RANSAC method, and then plot the results. Check youtube

BitcoinRaven 4 Mar 26, 2022
BT CCXT Store

bt-ccxt-store-cn backtrader是一个非常好的开源量化回测平台,我自己也时常用它,backtrader也能接入实盘,而bt-ccxt-store就是帮助backtrader接入数字货币实盘交易的一个插件,但是bt-ccxt-store的某些实现并不是很好,无节制的网络轮询,一些

moses 40 Dec 31, 2022