diff --git a/backend/api_app/smartcontract/migrations/0008_alter_smartcontract_chain.py b/backend/api_app/smartcontract/migrations/0008_alter_smartcontract_chain.py index 94383ed..ff7d148 100644 --- a/backend/api_app/smartcontract/migrations/0008_alter_smartcontract_chain.py +++ b/backend/api_app/smartcontract/migrations/0008_alter_smartcontract_chain.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('smartcontract', '0007_alter_smartcontract_chain'), + ("smartcontract", "0007_alter_smartcontract_chain"), ] operations = [ migrations.AlterField( - model_name='smartcontract', - name='chain', - field=models.CharField(choices=[('ETH', 'eth'), ('SOL', 'sol')], max_length=16), + model_name="smartcontract", + name="chain", + field=models.CharField( + choices=[("ETH", "eth"), ("SOL", "sol")], max_length=16 + ), ), ] diff --git a/backend/api_app/smartcontract/migrations/0009_alter_smartcontract_address.py b/backend/api_app/smartcontract/migrations/0009_alter_smartcontract_address.py index 21e11ac..ff087e0 100644 --- a/backend/api_app/smartcontract/migrations/0009_alter_smartcontract_address.py +++ b/backend/api_app/smartcontract/migrations/0009_alter_smartcontract_address.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('smartcontract', '0008_alter_smartcontract_chain'), + ("smartcontract", "0008_alter_smartcontract_chain"), ] operations = [ migrations.AlterField( - model_name='smartcontract', - name='address', + model_name="smartcontract", + name="address", field=models.CharField(max_length=44), ), ] diff --git a/backend/api_app/smartcontract/models.py b/backend/api_app/smartcontract/models.py index 44d8aaa..00065ce 100644 --- a/backend/api_app/smartcontract/models.py +++ b/backend/api_app/smartcontract/models.py @@ -12,6 +12,7 @@ class Chain(models.TextChoices): ETH = "ETH", "eth" SOL = "SOL", "sol" + class Network(models.TextChoices): # eth network choices MAINNET = "MAINNET", "mainnet" diff --git a/backend/api_app/smartcontract/serializers.py b/backend/api_app/smartcontract/serializers.py index 1ae3453..178fd46 100644 --- a/backend/api_app/smartcontract/serializers.py +++ b/backend/api_app/smartcontract/serializers.py @@ -1,5 +1,5 @@ -import re import logging +import re from rest_framework import serializers @@ -71,8 +71,10 @@ def smart_contract_validator(value): pattern_sol_check = pattern_sol.match(value) pattern_eth_check = pattern_eth.match(value) - logger.info(f"pattern_sol_check: {pattern_sol_check} and pattern_eth_check: {pattern_eth_check} for value: {value}") - + logger.info( + f"pattern_sol_check: {pattern_sol_check} and pattern_eth_check: {pattern_eth_check} for value: {value}" + ) + if not (pattern_sol_check or pattern_eth_check): raise serializers.ValidationError("Invalid smart contract address")