Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename gnosis -> safe_eth package #2209

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ psycogreen==1.0.2
psycopg2==2.9.9
redis==5.0.7
requests==2.32.3
safe-eth-py[django]==6.0.0b35
safe-eth-py[django]==6.0.0b37
web3==6.20.2
3 changes: 1 addition & 2 deletions safe_transaction_service/account_abstraction/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from eth_typing import ChecksumAddress
from hexbytes import HexBytes

from gnosis.eth.django.admin import AdvancedAdminSearchMixin
from safe_eth.eth.django.admin import AdvancedAdminSearchMixin

from .models import SafeOperation, UserOperation, UserOperationReceipt

Expand Down
9 changes: 4 additions & 5 deletions safe_transaction_service/account_abstraction/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
from typing import List

from eth_typing import ChecksumAddress

from gnosis.eth import EthereumClient
from gnosis.eth.contracts import get_safe_V1_4_1_contract
from gnosis.eth.utils import fast_to_checksum_address
from gnosis.safe.proxy_factory import ProxyFactoryV141
from safe_eth.eth import EthereumClient
from safe_eth.eth.contracts import get_safe_V1_4_1_contract
from safe_eth.eth.utils import fast_to_checksum_address
from safe_eth.safe.proxy_factory import ProxyFactoryV141


@dataclasses.dataclass(eq=True, frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from django.core.management.base import BaseCommand

from eth_typing import ChecksumAddress

from gnosis.eth.utils import fast_to_checksum_address
from safe_eth.eth.utils import fast_to_checksum_address

from safe_transaction_service.history.models import EthereumTx

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from django.db import migrations, models

import model_utils.fields

import gnosis.eth.django.models
import safe_eth.eth.django.models


class Migration(migrations.Migration):
Expand Down Expand Up @@ -39,15 +38,15 @@ class Migration(migrations.Migration):
),
(
"hash",
gnosis.eth.django.models.Keccak256Field(
safe_eth.eth.django.models.Keccak256Field(
primary_key=True, serialize=False
),
),
("valid_after", models.DateTimeField(null=True)),
("valid_until", models.DateTimeField(null=True)),
(
"module_address",
gnosis.eth.django.models.EthereumAddressV2Field(db_index=True),
safe_eth.eth.django.models.EthereumAddressV2Field(db_index=True),
),
],
options={
Expand Down Expand Up @@ -82,10 +81,10 @@ class Migration(migrations.Migration):
verbose_name="modified",
),
),
("owner", gnosis.eth.django.models.EthereumAddressV2Field()),
("owner", safe_eth.eth.django.models.EthereumAddressV2Field()),
(
"signature",
gnosis.eth.django.models.HexV2Field(
safe_eth.eth.django.models.HexV2Field(
default=None, max_length=5000, null=True
),
),
Expand Down Expand Up @@ -119,25 +118,25 @@ class Migration(migrations.Migration):
fields=[
(
"hash",
gnosis.eth.django.models.Keccak256Field(
safe_eth.eth.django.models.Keccak256Field(
primary_key=True, serialize=False
),
),
(
"sender",
gnosis.eth.django.models.EthereumAddressV2Field(db_index=True),
safe_eth.eth.django.models.EthereumAddressV2Field(db_index=True),
),
("nonce", gnosis.eth.django.models.Uint256Field()),
("nonce", safe_eth.eth.django.models.Uint256Field()),
("init_code", models.BinaryField(blank=True, editable=True, null=True)),
("call_data", models.BinaryField(blank=True, editable=True, null=True)),
("call_data_gas_limit", gnosis.eth.django.models.Uint256Field()),
("verification_gas_limit", gnosis.eth.django.models.Uint256Field()),
("pre_verification_gas", gnosis.eth.django.models.Uint256Field()),
("max_fee_per_gas", gnosis.eth.django.models.Uint256Field()),
("max_priority_fee_per_gas", gnosis.eth.django.models.Uint256Field()),
("call_data_gas_limit", safe_eth.eth.django.models.Uint256Field()),
("verification_gas_limit", safe_eth.eth.django.models.Uint256Field()),
("pre_verification_gas", safe_eth.eth.django.models.Uint256Field()),
("max_fee_per_gas", safe_eth.eth.django.models.Uint256Field()),
("max_priority_fee_per_gas", safe_eth.eth.django.models.Uint256Field()),
(
"paymaster",
gnosis.eth.django.models.EthereumAddressV2Field(
safe_eth.eth.django.models.EthereumAddressV2Field(
blank=True, db_index=True, null=True
),
),
Expand All @@ -148,7 +147,7 @@ class Migration(migrations.Migration):
("signature", models.BinaryField(blank=True, editable=True, null=True)),
(
"entry_point",
gnosis.eth.django.models.EthereumAddressV2Field(db_index=True),
safe_eth.eth.django.models.EthereumAddressV2Field(db_index=True),
),
(
"ethereum_tx",
Expand Down Expand Up @@ -182,11 +181,11 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("actual_gas_cost", gnosis.eth.django.models.Uint256Field()),
("actual_gas_used", gnosis.eth.django.models.Uint256Field()),
("actual_gas_cost", safe_eth.eth.django.models.Uint256Field()),
("actual_gas_used", safe_eth.eth.django.models.Uint256Field()),
("success", models.BooleanField()),
("reason", models.CharField(max_length=256)),
("deposited", gnosis.eth.django.models.Uint256Field()),
("deposited", safe_eth.eth.django.models.Uint256Field()),
(
"user_operation",
models.OneToOneField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.db import migrations

import gnosis.eth.django.models
import safe_eth.eth.django.models


class Migration(migrations.Migration):
Expand All @@ -18,28 +18,28 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="safeoperation",
name="module_address",
field=gnosis.eth.django.models.EthereumAddressBinaryField(db_index=True),
field=safe_eth.eth.django.models.EthereumAddressBinaryField(db_index=True),
),
migrations.AlterField(
model_name="safeoperationconfirmation",
name="owner",
field=gnosis.eth.django.models.EthereumAddressBinaryField(),
field=safe_eth.eth.django.models.EthereumAddressBinaryField(),
),
migrations.AlterField(
model_name="useroperation",
name="entry_point",
field=gnosis.eth.django.models.EthereumAddressBinaryField(db_index=True),
field=safe_eth.eth.django.models.EthereumAddressBinaryField(db_index=True),
),
migrations.AlterField(
model_name="useroperation",
name="paymaster",
field=gnosis.eth.django.models.EthereumAddressBinaryField(
field=safe_eth.eth.django.models.EthereumAddressBinaryField(
blank=True, db_index=True, null=True
),
),
migrations.AlterField(
model_name="useroperation",
name="sender",
field=gnosis.eth.django.models.EthereumAddressBinaryField(db_index=True),
field=safe_eth.eth.django.models.EthereumAddressBinaryField(db_index=True),
),
]
11 changes: 5 additions & 6 deletions safe_transaction_service/account_abstraction/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
from eth_abi.packed import encode_packed
from hexbytes import HexBytes
from model_utils.models import TimeStampedModel

from gnosis.eth.account_abstraction import UserOperation as UserOperationClass
from gnosis.eth.account_abstraction import UserOperationMetadata
from gnosis.eth.django.models import (
from safe_eth.eth.account_abstraction import UserOperation as UserOperationClass
from safe_eth.eth.account_abstraction import UserOperationMetadata
from safe_eth.eth.django.models import (
EthereumAddressBinaryField,
HexV2Field,
Keccak256Field,
Uint256Field,
)
from gnosis.safe.account_abstraction import SafeOperation as SafeOperationClass
from gnosis.safe.safe_signature import SafeSignatureType
from safe_eth.safe.account_abstraction import SafeOperation as SafeOperationClass
from safe_eth.safe.safe_signature import SafeSignatureType

from safe_transaction_service.history import models as history_models
from safe_transaction_service.utils.constants import SIGNATURE_LENGTH
Expand Down
13 changes: 6 additions & 7 deletions safe_transaction_service/account_abstraction/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
from django.db import transaction
from django.utils import timezone

import safe_eth.eth.django.serializers as eth_serializers
from eth_typing import ChecksumAddress, HexStr
from hexbytes import HexBytes
from rest_framework import serializers
from rest_framework.exceptions import ValidationError

import gnosis.eth.django.serializers as eth_serializers
from gnosis.eth import get_auto_ethereum_client
from gnosis.eth.account_abstraction import UserOperation as UserOperationClass
from gnosis.eth.utils import fast_keccak, fast_to_checksum_address
from gnosis.safe.account_abstraction import SafeOperation as SafeOperationClass
from gnosis.safe.safe_signature import SafeSignature, SafeSignatureType
from safe_eth.eth import get_auto_ethereum_client
from safe_eth.eth.account_abstraction import UserOperation as UserOperationClass
from safe_eth.eth.utils import fast_keccak, fast_to_checksum_address
from safe_eth.safe.account_abstraction import SafeOperation as SafeOperationClass
from safe_eth.safe.safe_signature import SafeSignature, SafeSignatureType

from safe_transaction_service.utils.constants import SIGNATURE_LENGTH
from safe_transaction_service.utils.ethereum import get_chain_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@

from eth_typing import ChecksumAddress, HexStr
from hexbytes import HexBytes
from web3.types import LogReceipt

from gnosis.eth import EthereumClient, get_auto_ethereum_client
from gnosis.eth.account_abstraction import (
from safe_eth.eth import EthereumClient, get_auto_ethereum_client
from safe_eth.eth.account_abstraction import (
BundlerClient,
BundlerClientException,
UserOperation,
UserOperationReceipt,
UserOperationV07,
)
from gnosis.eth.utils import fast_to_checksum_address
from gnosis.safe.account_abstraction import SafeOperation
from gnosis.safe.safe_signature import SafeSignature
from safe_eth.eth.utils import fast_to_checksum_address
from safe_eth.safe.account_abstraction import SafeOperation
from safe_eth.safe.safe_signature import SafeSignature
from web3.types import LogReceipt

from safe_transaction_service.history import models as history_models

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from eth_abi.packed import encode_packed
from eth_account import Account
from factory.django import DjangoModelFactory

from gnosis.eth.constants import NULL_ADDRESS
from gnosis.eth.utils import fast_keccak_text
from gnosis.safe.safe_signature import SafeSignatureType
from safe_eth.eth.constants import NULL_ADDRESS
from safe_eth.eth.utils import fast_keccak_text
from safe_eth.safe.safe_signature import SafeSignatureType

from safe_transaction_service.history.tests import factories as history_factories

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
from django.test import TestCase

from eth_account import Account

from gnosis.eth import EthereumClient
from gnosis.eth.account_abstraction import BundlerClient
from gnosis.eth.account_abstraction import UserOperation as UserOperationClass
from gnosis.eth.account_abstraction import (
from safe_eth.eth import EthereumClient
from safe_eth.eth.account_abstraction import BundlerClient
from safe_eth.eth.account_abstraction import UserOperation as UserOperationClass
from safe_eth.eth.account_abstraction import (
UserOperationReceipt as UserOperationReceiptClass,
)
from gnosis.eth.tests.mocks.mock_bundler import (
from safe_eth.eth.tests.mocks.mock_bundler import (
safe_4337_user_operation_hash_mock,
user_operation_mock,
user_operation_receipt_mock,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.test import TestCase

from hexbytes import HexBytes

from gnosis.eth.tests.mocks.mock_bundler import user_operation_mock
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.eth.tests.mocks.mock_bundler import user_operation_mock
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from ..helpers import DecodedInitCode, decode_init_code

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from django.test import TestCase

from gnosis.eth.account_abstraction import UserOperation as UserOperationClass
from gnosis.eth.tests.mocks.mock_bundler import (
from safe_eth.eth.account_abstraction import UserOperation as UserOperationClass
from safe_eth.eth.tests.mocks.mock_bundler import (
safe_4337_module_address_mock,
safe_4337_safe_operation_hash_mock,
safe_4337_user_operation_hash_mock,
user_operation_mock,
)
from gnosis.safe.account_abstraction import SafeOperation as SafeOperationClass
from safe_eth.safe.account_abstraction import SafeOperation as SafeOperationClass

from safe_transaction_service.history.tests import factories as history_factories

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
from rest_framework.test import APITestCase

from gnosis.eth import EthereumClient
from gnosis.eth.account_abstraction import UserOperation as UserOperationClass
from gnosis.eth.constants import NULL_ADDRESS
from gnosis.eth.tests.mocks.mock_bundler import (
from safe_eth.eth import EthereumClient
from safe_eth.eth.account_abstraction import UserOperation as UserOperationClass
from safe_eth.eth.constants import NULL_ADDRESS
from safe_eth.eth.tests.mocks.mock_bundler import (
safe_4337_address,
safe_4337_chain_id_mock,
safe_4337_module_address_mock,
safe_4337_safe_operation_hash_mock,
safe_4337_user_operation_hash_mock,
user_operation_mock,
)
from gnosis.eth.utils import fast_keccak, fast_to_checksum_address
from gnosis.safe.account_abstraction import SafeOperation as SafeOperationClass
from gnosis.safe.proxy_factory import ProxyFactoryV141
from gnosis.safe.safe_signature import SafeSignatureEOA, SafeSignatureType
from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.eth.utils import fast_keccak, fast_to_checksum_address
from safe_eth.safe.account_abstraction import SafeOperation as SafeOperationClass
from safe_eth.safe.proxy_factory import ProxyFactoryV141
from safe_eth.safe.safe_signature import SafeSignatureEOA, SafeSignatureType
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from safe_transaction_service.utils.utils import datetime_to_str

Expand Down
5 changes: 2 additions & 3 deletions safe_transaction_service/account_abstraction/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

from eth_typing import ChecksumAddress
from hexbytes import HexBytes
from safe_eth.eth.account_abstraction import BundlerClient
from safe_eth.eth.utils import fast_to_checksum_address
from web3.types import LogReceipt

from gnosis.eth.account_abstraction import BundlerClient
from gnosis.eth.utils import fast_to_checksum_address

logger = logging.getLogger(__name__)


Expand Down
3 changes: 1 addition & 2 deletions safe_transaction_service/account_abstraction/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from rest_framework.filters import OrderingFilter
from rest_framework.generics import ListAPIView, ListCreateAPIView, RetrieveAPIView
from rest_framework.response import Response

from gnosis.eth.utils import fast_is_checksum_address
from safe_eth.eth.utils import fast_is_checksum_address

from . import pagination, serializers
from .models import SafeOperation, SafeOperationConfirmation, UserOperation
Expand Down
3 changes: 1 addition & 2 deletions safe_transaction_service/analytics/tests/test_views_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase

from gnosis.safe.tests.safe_test_case import SafeTestCaseMixin
from safe_eth.safe.tests.safe_test_case import SafeTestCaseMixin

from safe_transaction_service.history.tests.factories import MultisigTransactionFactory

Expand Down
Loading