Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu authored Sep 26, 2024
2 parents 4a35195 + 050addf commit 75748e7
Show file tree
Hide file tree
Showing 28 changed files with 337 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
update-draft:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prtitle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -39,10 +39,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -60,22 +60,22 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
safe-version: ["1.3.0"]

env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.4.2

hooks:
- id: black
name: black
Expand All @@ -21,7 +22,7 @@ repos:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools, pydantic]
Expand All @@ -30,7 +31,7 @@ repos:
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
additional_dependencies: [mdformat-gfm, mdformat-frontmatter, mdformat-pyproject]

default_language_version:
python: python3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Account plugin for the [Safe](https://safe.global//) Multisig wallet (previously

## Dependencies

- [python3](https://www.python.org/downloads) version 3.8 up to 3.11.
- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.

## Installation

Expand Down
44 changes: 21 additions & 23 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,32 @@ ethereum:
default_provider: foundry

dependencies:
- name: openzeppelin
github: OpenZeppelin/openzeppelin-contracts
version: 3.4.0
- name: safe-contracts
npm: "@gnosis.pm/safe-contracts"
version: 1.3.0
github: safe-global/safe-smart-account
version: v1.3.0
config_override:
solidity:
version: 0.7.6
compile:
exclude:
- "test/*"
- "interfaces/*"
- test
- examples
- interfaces/ViewStorageAccessible.sol

dependencies:
- name: openzeppelin
github: OpenZeppelin/openzeppelin-contracts
version: 3.4.0

solidity:
import_remapping:
- "@openzeppelin/contracts=openzeppelin/v3.4.0"
- "@gnosis=safe-contracts/v1.3.0"
solidity:
version: 0.7.6
import_remapping:
- "@openzeppelin/contracts=openzeppelin/v3.4.0"

foundry:
fork:
ethereum:
mainnet:
upstream_provider: alchemy
block_number: 15776634
goerli:
upstream_provider: alchemy
block_number: 7849922
sepolia:
upstream_provider: alchemy
block_number: 3091950
ethereum:
mainnet:
upstream_provider: alchemy
block_number: 15776634
sepolia:
upstream_provider: alchemy
block_number: 3091950
3 changes: 2 additions & 1 deletion ape_safe/_cli/click_ext.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import NoReturn, Optional, Sequence, Union, cast
from collections.abc import Sequence
from typing import NoReturn, Optional, Union, cast

import click
from ape.api import AccountAPI
Expand Down
13 changes: 7 additions & 6 deletions ape_safe/_cli/pending.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Dict, List, Optional, Sequence, Union, cast
from collections.abc import Sequence
from typing import Optional, Union, cast

import click
import rich
Expand Down Expand Up @@ -46,7 +47,7 @@ def _list(cli_ctx, safe, verbose) -> None:
rich.print("There are no pending transactions.")
return

txns_by_nonce: Dict[int, List[UnexecutedTxData]] = {}
txns_by_nonce: dict[int, list[UnexecutedTxData]] = {}
for txn in txns:
if txn.nonce in txns_by_nonce:
txns_by_nonce[txn.nonce].append(txn)
Expand Down Expand Up @@ -128,7 +129,7 @@ def propose(cli_ctx, ecosystem, safe, data, gas_price, value, receiver, nonce, s
)
safe_tx = safe.create_safe_tx(txn)
safe_tx_hash = get_safe_tx_hash(safe_tx)
signatures = get_signatures(safe_tx_hash, safe.local_signers)
signatures = get_signatures(safe_tx, safe.local_signers)

num_confirmations = 0
submitter = sender if isinstance(sender, AccountAPI) else None
Expand Down Expand Up @@ -191,7 +192,6 @@ def approve(cli_ctx: SafeCliContext, safe, txn_ids, execute):

safe_tx = safe.create_safe_tx(**txn.model_dump(by_alias=True, mode="json"))
num_confirmations = len(txn.confirmations)
signatures_added = {}

if num_confirmations < safe.confirmations_required:
signatures_added = safe.add_signatures(safe_tx, confirmations=txn.confirmations)
Expand All @@ -216,7 +216,8 @@ def approve(cli_ctx: SafeCliContext, safe, txn_ids, execute):
submitter = safe.select_signer(for_="submitter")

if submitter:
txn.confirmations = {**txn.confirmations, **signatures_added}
safe_tx_hash = get_safe_tx_hash(safe_tx)
txn.confirmations = safe.client.get_confirmations(safe_tx_hash)
_execute(safe, txn, submitter)

# If any txn_ids remain, they were not handled.
Expand Down Expand Up @@ -259,7 +260,7 @@ def execute(cli_ctx, safe, txn_ids, submitter, nonce):

def _execute(safe: SafeAccount, txn: UnexecutedTxData, submitter: AccountAPI, **tx_kwargs):
safe_tx = safe.create_safe_tx(**txn.model_dump(mode="json", by_alias=True))
signatures: Dict[AddressType, MessageSignature] = {
signatures: dict[AddressType, MessageSignature] = {
c.owner: MessageSignature.from_rsv(c.signature) for c in txn.confirmations
}
exc_tx = safe.create_execute_transaction(safe_tx, signatures, **tx_kwargs)
Expand Down
8 changes: 6 additions & 2 deletions ape_safe/_cli/safe_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,16 @@ def remove(cli_ctx: SafeCliContext, safe, skip_confirmation):

@click.command(cls=ConnectedProviderCommand)
@safe_cli_ctx()
@click.argument("address", type=ChecksumAddress)
@click.argument("account")
@click.option("--confirmed", is_flag=True, default=None)
def all_txns(cli_ctx: SafeCliContext, address, confirmed):
def all_txns(cli_ctx: SafeCliContext, account, confirmed):
"""
View and filter all transactions for a given Safe using Safe API
"""
if account in cli_ctx.account_manager.aliases:
account = cli_ctx.account_manager.load(account)

address = cli_ctx.conversion_manager.convert(account, AddressType)

# NOTE: Create a client to support non-local safes.
client = cli_ctx.safes.create_client(address)
Expand Down
Loading

0 comments on commit 75748e7

Please sign in to comment.