ape-safe: Gnosis Safe account plugin for Ape
Project description
Quick Start
Account plugin for the Safe Multisig wallet (previously known as Gnosis Safe).
Dependencies
- python3 version 3.8 up to 3.11.
Installation
via ape
You can install using the ape built-in plugin manager:
$ ape plugins install safe
via pip
You can install the latest release via pip
:
$ pip install ape-safe
via setuptools
You can clone the repository and use setuptools
for the most up-to-date version:
$ git clone https://github.com/ApeWorX/ape-safe.git
$ cd ape-safe
$ python3 setup.py install
Quick Usage
To use the plugin, first use the CLI extension to add a safe you created:
ape safe add --network ethereum:mainnet "my-safe.eth" my-safe
If you made a mistake or just need to remove the safe, use the remove
command:
ape safe remove my-safe --yes
NOTE --yes
is a way to skip the prompt.
If you only add one safe, you will not have to specify which safe to use other commands.
Otherwise, for most pending
commands, you specify the safe to use (by alias) via the --safe
option.
Additionally, you can configure a safe to use as the default in your ape-config.yaml
file:
safe:
default_safe: my-safe
NOTE: Also, to avoid always needing to specify --network
, you can set a default ecosystem, network, and provider in your config file.
The rest of the guide with not specify --network
on each command but assume the correct one is set in the config file.
Here is an example:
default_ecosystem: optimism
ethereum:
default_network: sepolia
sepolia:
default_provider: infura
Once you have a safe, you can view pending transactions:
ape safe pending list
It should show transactions like this:
Transaction 8 rejection (1/2) safe_tx_hash=0x09ab9a229fc60da66ec0fa8fa886ab7c95902fdf5df5a5009ba06010fbb9a9a7
Transaction 8 transfer (1/2) safe_tx_hash=0xed43d80255bcd5ffacb755e8f51bee825913373705d6baea006419d2a33a0a5b
NOTE: Use the --verbose
flag to see more information about each transaction.
ape safe pending list --verbose
There are several operations you can do on a pending transaction. One of them is "approve" which adds your local signers' signatures to the transaction.
ape safe pending approve 0x09ab9a229fc60da66ec0fa8fa886ab7c95902fdf5df5a5009ba06010fbb9a9a7
NOTE: Here we are using the transaction hash 0x09ab9a229fc60da66ec0fa8fa886ab7c95902fdf5df5a5009ba06010fbb9a9a7
to specify the transaction because there are more than one.
However, you can also use the nonce if there is only a single transaction.
If you want to both execute and approve at the same time, you can use the --execute
option on approve and specify a sender:
ape safe pending approve 2 --execute my_account
Else, you can use the execute
command directly:
ape safe pending execute 2
NOTE: execute
requires a full signed transaction ready to be submitted on-chain.
The last main operation is reject
.
Rejecting a transaction replaces that transaction with a zero-value transfer from the safe to itself.
ape safe pending reject 2
Multisend
The following example shows how to use multisend:
from ape_safe import multisend
from ape import accounts
from ape_tokens import tokens
safe = accounts.load("my-safe")
# Load some contracts (here using ape-tokens)
dai = tokens["DAI"]
vault = tokens["yvDAI"]
amount = dai.balanceOf(safe) # How much we want to deposit
# Create a multisend transaction (a transaction that executes multiple calls)
txn = multisend.Transaction()
txn.add(dai.approve, vault, amount)
txn.add(vault.deposit, amount)
# Fetch signatures from any local signers, and broadcast if confirmations are met
# Otherwise, it will post the partially confirmed message to Safe Global's API
txn(sender=safe)
Development
Please see the contributing guide to learn more how to contribute to this project. Comments, questions, criticisms and pull requests are welcomed.
Acknowledgements
This package was inspired by the original ape-safe by banteg. For versions prior to v0.6.0, the original package should be referenced.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ape-safe-0.7.0b0.tar.gz
.
File metadata
- Download URL: ape-safe-0.7.0b0.tar.gz
- Upload date:
- Size: 91.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.1 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0376d8e6241b0ddb90231252c1e07936314e4a3bf9488f0522f8a030a5ca697a |
|
MD5 | 3da8f4bc7d34fd05bf41ee6f6058b3c5 |
|
BLAKE2b-256 | 80424eb5a3e5cd8c79fdd3485754586f5689e57661e79fdc3077549565a8e781 |
File details
Details for the file ape_safe-0.7.0b0-py3-none-any.whl
.
File metadata
- Download URL: ape_safe-0.7.0b0-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.1.0 tqdm/4.66.1 importlib-metadata/7.0.1 keyring/24.3.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 665ac6dec3ed3a8224beacb83c23cbabc0988771df50788aaf7e567de056fe80 |
|
MD5 | 94a152813d50861648245a036210fd02 |
|
BLAKE2b-256 | b63ed1e1659b11b28b9998a7d4d663b40c4c0e309648a9db31ec27c92bb5333f |