Skip to content

Commit

Permalink
docs: much improve guide
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Dec 21, 2023
1 parent f590a55 commit 178b4cb
Showing 1 changed file with 84 additions and 26 deletions.
110 changes: 84 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,94 @@ $ python3 setup.py install

To use the plugin, first use the CLI extension to add a safe you created:

```bash
```sh
ape safe add --network ethereum:mainnet "my-safe.eth" my-safe
```

If you only add 1 safe, you will not have to specify in future commands.
Otherwise, for most commands, specify the safe using the `--safe` option by alias.
If you made a mistake or just need to remove the safe, use the `remove` command:

```sh
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:

```yaml
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:

```yaml
default_ecosystem: optimism
ethereum:
default_network: sepolia
sepolia:
default_provider: infura
```

Once you have a safe, you can view pending transactions:

```sh
ape safe pending list
```

It should show transactions like this:

```sh
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.

```sh
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.

```sh
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:

```sh
ape safe pending approve 2 --execute my_account
```

Else, you can use the `execute` command directly:

```sh
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.

```sh
ape safe pending reject 2
```

### Multisend

Once you've added a safe, you manage pending transactions:
The following example shows how to use multisend:

```python
from ape_safe import multisend
Expand All @@ -69,28 +149,6 @@ txn.add(vault.deposit, amount)
txn(sender=safe)
```

Propose a simple transaction by using `submit=False` as a transaction kwargs so it can await signatures from other signers:

```python
from ape import accounts

safe = accounts.load("my-safe")
other = accounts.load("other")
safe.transfer(other, "1 wei", submit=False)
```

**NOTE**: It may error saying the transaction was not fully signed but that is ok.

You can use the CLI extension to view and sign for pending transactions:

```bash
ape safe pending list --network ethereum:goerli:alchemy
ape safe pending show-confs 2 --network ethereum:goerli:alchemy
ape safe pending approve 3 --network ethereum:goerli:alchemy
ape safe pending reject 4 --network ethereum:goerli:alchemy
ape safe pending execute 4 --network ethereum:goerli:alchemy --submitter metamask0
```

## Development

Please see the [contributing guide](CONTRIBUTING.md) to learn more how to contribute to this project.
Expand Down

0 comments on commit 178b4cb

Please sign in to comment.