diff --git a/safe_transaction_service/account_abstraction/migrations/0001_initial.py b/safe_transaction_service/account_abstraction/migrations/0001_initial.py index ba555b532..882bfa276 100644 --- a/safe_transaction_service/account_abstraction/migrations/0001_initial.py +++ b/safe_transaction_service/account_abstraction/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.10 on 2024-03-08 15:36 +# Generated by Django 5.0.3 on 2024-03-25 13:34 import django.db.models.deletion import django.utils.timezone @@ -10,10 +10,11 @@ class Migration(migrations.Migration): + initial = True dependencies = [ - ("history", "0079_alter_erc20transfer_unique_together_and_more"), + ("history", "0080_alter_multisigconfirmation_signature"), ] operations = [ @@ -53,6 +54,66 @@ class Migration(migrations.Migration): "abstract": False, }, ), + migrations.CreateModel( + name="SafeOperationConfirmation", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "created", + model_utils.fields.AutoCreatedField( + default=django.utils.timezone.now, + editable=False, + verbose_name="created", + ), + ), + ( + "modified", + model_utils.fields.AutoLastModifiedField( + default=django.utils.timezone.now, + editable=False, + verbose_name="modified", + ), + ), + ("owner", gnosis.eth.django.models.EthereumAddressV2Field()), + ( + "signature", + gnosis.eth.django.models.HexV2Field( + default=None, max_length=5000, null=True + ), + ), + ( + "signature_type", + models.PositiveSmallIntegerField( + choices=[ + (0, "CONTRACT_SIGNATURE"), + (1, "APPROVED_HASH"), + (2, "EOA"), + (3, "ETH_SIGN"), + ], + db_index=True, + ), + ), + ( + "safe_operation", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="confirmations", + to="account_abstraction.safeoperation", + ), + ), + ], + options={ + "ordering": ["created"], + }, + ), migrations.CreateModel( name="UserOperation", fields=[ @@ -100,6 +161,15 @@ class Migration(migrations.Migration): ), ], ), + migrations.AddField( + model_name="safeoperation", + name="user_operation", + field=models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="safe_operation", + to="account_abstraction.useroperation", + ), + ), migrations.CreateModel( name="UserOperationReceipt", fields=[ @@ -127,73 +197,11 @@ class Migration(migrations.Migration): ), ], ), - migrations.CreateModel( - name="SafeOperationConfirmation", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ( - "created", - model_utils.fields.AutoCreatedField( - default=django.utils.timezone.now, - editable=False, - verbose_name="created", - ), - ), - ( - "modified", - model_utils.fields.AutoLastModifiedField( - default=django.utils.timezone.now, - editable=False, - verbose_name="modified", - ), - ), - ("owner", gnosis.eth.django.models.EthereumAddressV2Field()), - ( - "signature", - gnosis.eth.django.models.HexField( - default=None, max_length=5000, null=True - ), - ), - ( - "signature_type", - models.PositiveSmallIntegerField( - choices=[ - (0, "CONTRACT_SIGNATURE"), - (1, "APPROVED_HASH"), - (2, "EOA"), - (3, "ETH_SIGN"), - ], - db_index=True, - ), - ), - ( - "safe_operation", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="confirmations", - to="account_abstraction.safeoperation", - ), - ), - ], - options={ - "ordering": ["created"], - }, - ), - migrations.AddField( - model_name="safeoperation", - name="user_operation", - field=models.OneToOneField( - on_delete=django.db.models.deletion.CASCADE, - related_name="safe_operation", - to="account_abstraction.useroperation", + migrations.AddConstraint( + model_name="safeoperationconfirmation", + constraint=models.UniqueConstraint( + fields=("safe_operation", "owner"), + name="unique_safe_operation_owner_confirmation", ), ), migrations.AddIndex( @@ -206,11 +214,4 @@ class Migration(migrations.Migration): name="useroperation", unique_together={("sender", "nonce")}, ), - migrations.AddConstraint( - model_name="safeoperationconfirmation", - constraint=models.UniqueConstraint( - fields=("safe_operation", "owner"), - name="unique_safe_operation_owner_confirmation", - ), - ), ] diff --git a/safe_transaction_service/account_abstraction/models.py b/safe_transaction_service/account_abstraction/models.py index bc17b0832..6bedc1c75 100644 --- a/safe_transaction_service/account_abstraction/models.py +++ b/safe_transaction_service/account_abstraction/models.py @@ -12,7 +12,7 @@ from gnosis.eth.account_abstraction import UserOperationMetadata from gnosis.eth.django.models import ( EthereumAddressV2Field, - HexField, + HexV2Field, Keccak256Field, Uint256Field, )