You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-61Lines changed: 43 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,24 +45,28 @@ $ python3 setup.py install
45
45
46
46
## Quick Usage
47
47
48
-
To use the plugin, first use the CLI extension to add a safe you created:
48
+
To use the plugin, first use the Ape CLI extension to add a safe you want to control:
49
49
50
50
```sh
51
-
ape safe add --network ethereum:mainnet "my-safe.eth" my-safe
51
+
# ape safe add ADDRESS ALIAS
52
+
ape safe add --network ethereum:mainnet my-safe.eth my-safe
52
53
```
53
54
54
55
If you made a mistake or just need to remove the safe, use the `remove` command:
55
56
56
57
```sh
58
+
# ape safe remove ALIAS
57
59
ape safe remove my-safe --yes
58
60
```
59
61
60
-
**NOTE**`--yes` is a way to skip the prompt.
62
+
```{note}
63
+
`--yes` is a way to skip the prompt.
64
+
```
61
65
62
-
If you only add one safe, you will not have to specify which safe to use other commands.
66
+
If you only have one safe, you will not have to specify which safe to use other commands.
63
67
Otherwise, for most `pending` commands, you specify the safe to use (by alias) via the `--safe` option.
64
68
65
-
Additionally, you can configure a safe to use as the default in your `ape-config.yaml` file:
69
+
Additionally, you can configure a safe to use as the default when no `--safe` argument is present by configuring the following in your `ape-config.yaml` file:
66
70
67
71
```yaml
68
72
safe:
@@ -76,28 +80,17 @@ or via `pyproject.toml`:
76
80
default_safe = "my-safe"
77
81
```
78
82
79
-
To specify via environment variable, do:
83
+
or specify via environment variable:
80
84
81
85
```sh
82
-
APE_SAFE_DEFAULT_SAFE="my-safe"
86
+
export APE_SAFE_DEFAULT_SAFE="my-safe"
83
87
```
84
88
85
-
**NOTE**: To avoid always needing to specify `--network`, you can set a default ecosystem, network, and provider in your config file.
86
-
Here is an example:
87
-
88
-
```yaml
89
-
default_ecosystem: ethereum
90
-
91
-
ethereum:
92
-
default_network: mainnet
93
-
mainnet:
94
-
default_provider: infura
89
+
```{note}
90
+
To avoid always needing to specify `--network`, you can set a default ecosystem, network, and provider in your config file.
91
+
The rest of the guide will not specify `--network` on each command but assume it matches the network your Safe is on.
95
92
```
96
93
97
-
The rest of the guide will not specify `--network` on each command but assume the correct one is set in the config file.
98
-
99
-
---
100
-
101
94
Once you have a safe, you can view pending transactions:
102
95
103
96
```sh
@@ -106,14 +99,14 @@ ape safe pending list
106
99
107
100
```{note}
108
101
You must specify the environment variable `APE_SAFE_GATEWAY_API_KEY=` to use the Safe Gateway API.
109
-
Get an API key at https://developer.safe.global/.
102
+
Get an API key at the [Safe Developer Portal](https://developer.safe.global).
Transaction 8 transfer (1/2) safe_tx_hash=0xed43...0a5b
117
110
```
118
111
119
112
Use the `--verbose` flag to see more information about each transaction:
@@ -125,47 +118,51 @@ ape safe pending list --verbose
125
118
There are several operations you can do on a pending transaction:
126
119
127
120
```sh
128
-
# Approve a transaction (add your signature)
129
-
ape safe pending approve 0x09ab9a229fc60da66ec0fa8fa886ab7c95902fdf5df5a5009ba06010fbb9a9a7
121
+
# Add more signatures using locally-configured Ape signer(s)
122
+
# NOTE: can specify either SafeTxID or Nonce
123
+
ape safe pending approve 0x09ab...a9a7
130
124
131
-
# Approve and execute in one step
132
-
ape safe pending approve 2 --execute my_account
125
+
# Add remaining signatures and execute transction w/ account alias `submitter`
126
+
# NOTE: can specify either SafeTxID or Nonce
127
+
ape safe pending approve 2 --execute submitter
133
128
134
-
# Execute a fully signed transaction
135
-
ape safe pending execute 2
129
+
# Execute an already-signed transaction using `submitter`
130
+
ape safe pending execute 2 --account submitter
136
131
137
-
#Reject a transaction
132
+
#Create an on-chain rejection for an existing transaction queue item
138
133
ape safe pending reject 2
139
134
```
140
135
141
-
## MultiSend Example
136
+
###MultiSend Support
142
137
143
-
The following example shows how to use multisend to batch transactions:
138
+
Ape Safe allows sending "batched transactions" using the `MultiSend` module:
144
139
145
140
```python
146
-
from ape_safe import multisend
147
141
from ape import accounts
142
+
from ape_safe import multisend
148
143
from ape_tokens import tokens
149
144
145
+
me = accounts.load("my-key")
150
146
safe = accounts.load("my-safe")
151
147
152
148
# Load some contracts using ape-tokens
153
149
dai = tokens["DAI"]
154
150
vault = tokens["yvDAI"]
155
151
amount = dai.balanceOf(safe) # How much we want to deposit
156
152
157
-
# Create a multisend transaction (a transaction that executes multiple calls)
158
-
txn=multisend.MultiSend()
159
-
txn.add(dai.approve, vault, amount)
160
-
txn.add(vault.deposit, amount)
153
+
# Create a multisend batch transaction
154
+
batch=safe.create_batch()
155
+
batch.add(dai.approve, vault, amount)
156
+
batch.add(vault.deposit, amount)
161
157
162
-
# Fetch signatures from local signers and broadcast if confirmations are met
163
-
txn(sender=safe, gas=0)
158
+
# Fetch signatures from local signer(s)
159
+
#NOTE: will broadcast unless `submit=False`
160
+
batch(submitter=me)
161
+
# OR add to the Safe Gateway for later execution
162
+
batch.propose()
164
163
```
165
164
166
-
<<<<<<< HEAD
167
-
168
-
## Cloud Usage
165
+
### Cloud Environment
169
166
170
167
To use this plugin in a cloud environment, such as with the [Silverback Platform](https://silverback.apeworx.io), you will need to make sure that you have configured your Safe to exist within the environment.
171
168
The easiest way to do this is to use the `require` configuration item.
@@ -176,15 +173,15 @@ safe:
176
173
require:
177
174
my-safe:
178
175
address: "0x1234...AbCd"
179
-
deployed_chain_ids: [1, ...]
176
+
deployed_chain_ids: [1, 10] # Add all deployed chains here
180
177
```
181
178
182
179
or in `pyproject.toml`:
183
180
184
181
```toml
185
182
[tool.ape.safe.require."my-safe"]
186
183
address = "0x1234...AbCd"
187
-
deployed_chain_ids = [1, ...]
184
+
deployed_chain_ids = [1, 10] # Add all deployed chains here
188
185
```
189
186
190
187
To specify via environment variable, do:
@@ -193,25 +190,10 @@ To specify via environment variable, do:
If a safe with the same alias as an entry in `require` exists in your local environment, this will skip adding it, even if the existing alias points to a different address than the one in the config item.
198
195
```
199
196
200
-
=======
201
-
202
-
## Documentation
203
-
204
-
For more detailed documentation, see:
205
-
206
-
-[Setup](./docs/setup.md) - Configuration and initial setup
0 commit comments