From 174d19554305bb3d889f931347bc488f5cff6c33 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:55:12 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Auto-formated=20Python=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0008_alter_smartcontract_chain.py | 11 ++++++----- .../migrations/0009_alter_smartcontract_address.py | 7 +++---- backend/api_app/smartcontract/models.py | 1 + backend/api_app/smartcontract/serializers.py | 8 +++++--- 4 files changed, 15 insertions(+), 12 deletions(-) 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")