forked from protofire/safe-config-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
223 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
APPLICATION_VERSION=2.80.0 | ||
APPLICATION_VERSION=2.83.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,3 +135,4 @@ data/ | |
docker-compose.override.yml | ||
.vscode/ | ||
src/media/ | ||
!src/media/safe_apps/icon_url.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.12.3-slim | ||
FROM python:3.12.4-slim | ||
|
||
# python | ||
ENV PYTHONUNBUFFERED=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
-r requirements.txt | ||
black==24.4.2 | ||
coverage==7.5.1 | ||
coverage==7.5.4 | ||
factory-boy==3.3.0 | ||
Faker==25.1.0 | ||
flake8==7.0.0 | ||
Faker==25.9.1 | ||
flake8==7.1.0 | ||
isort==5.13.2 | ||
pre-commit==3.7.1 | ||
pytest-django==4.8.0 | ||
responses==0.25.0 | ||
responses==0.25.3 | ||
|
||
# mypy and PEP 561 stubs | ||
mypy==1.10.0 | ||
django-stubs==5.0.0 | ||
django-stubs==5.0.2 | ||
djangorestframework-stubs==3.15.0 | ||
types-requests==2.31.0.20240406 | ||
types-requests==2.32.0.20240602 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
boto3==1.34.103 | ||
boto3==1.34.131 | ||
Django==5.0.6 | ||
django-cors-headers==4.3.1 | ||
djangorestframework==3.15.1 | ||
django-cors-headers==4.4.0 | ||
djangorestframework==3.15.2 | ||
djangorestframework-camel-case==1.4.2 | ||
django-storages==1.14.3 | ||
django-stubs-ext==5.0.0 | ||
django-stubs-ext==5.0.2 | ||
drf-yasg[validation]==1.21.7 | ||
safe-eth-py[django]==5.8.0 | ||
gunicorn==22.0.0 | ||
Pillow==10.3.0 | ||
psycopg2-binary==2.9.9 | ||
requests==2.31.0 | ||
requests==2.32.3 | ||
web3==6.11.4 |
26 changes: 26 additions & 0 deletions
26
src/chains/migrations/0042_chain_balances_provider_chain_name_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.2 on 2024-06-13 11:11 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("chains", "0041_chain_prices_provider_chain_name_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="chain", | ||
name="balances_provider_chain_name", | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name="chain", | ||
name="balances_provider_enabled", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="This flag informs API clients whether the balances provider is enabled for the chain", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.db.migrations.state import StateApps | ||
|
||
from chains.migrations.tests.utils import TestMigrations | ||
|
||
|
||
class Migration0042TestCase(TestMigrations): | ||
migrate_from = "0041_chain_prices_provider_chain_name_and_more" | ||
migrate_to = "0042_chain_balances_provider_chain_name_and_more" | ||
|
||
def setUpBeforeMigration(self, apps: StateApps) -> None: | ||
Chain = apps.get_model("chains", "Chain") | ||
Chain.objects.create( | ||
id=1, | ||
name="Mainnet", | ||
short_name="eth", | ||
description="", | ||
l2=False, | ||
rpc_authentication="API_KEY_PATH", | ||
rpc_uri="https://mainnet.infura.io/v3/", | ||
safe_apps_rpc_authentication="API_KEY_PATH", | ||
safe_apps_rpc_uri="https://mainnet.infura.io/v3/", | ||
block_explorer_uri_address_template="https://etherscan.io/address/{{address}}", | ||
block_explorer_uri_tx_hash_template="https://etherscan.io/tx/{{txHash}}", | ||
currency_name="Ether", | ||
currency_symbol="ETH", | ||
currency_decimals=18, | ||
currency_logo_uri="https://gnosis-safe-token-logos.s3.amazonaws.com/ethereum-eth-logo.png", | ||
transaction_service_uri="http://mainnet-safe-transaction-web.safe.svc.cluster.local", | ||
vpc_transaction_service_uri="", | ||
theme_text_color="#001428", | ||
theme_background_color="#E8E7E6", | ||
ens_registry_address="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", | ||
recommended_master_copy_version="1.3.0", | ||
prices_provider_native_coin="ethereum", | ||
prices_provider_chain_name="ethereum", | ||
hidden=False, | ||
) | ||
|
||
def test_new_fields(self) -> None: | ||
Chain = self.apps_registry.get_model("chains", "Chain") | ||
|
||
chain = Chain.objects.get(id=1) | ||
|
||
self.assertEqual(chain.balances_provider_chain_name, None) | ||
self.assertEqual(chain.balances_provider_enabled, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Associated with migration #0014, ensuring that all SafeApps have an icon_url | ||
# before making it non-nullable. Assigning a value and changing the field to | ||
# non-nullable in the same migration otherwise causes an error. | ||
|
||
from django.db import migrations | ||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor | ||
from django.db.migrations.state import StateApps | ||
from django.db.models import Q | ||
|
||
|
||
def assign_missing_default_icon_url( | ||
apps: StateApps, schema_editor: BaseDatabaseSchemaEditor | ||
) -> None: | ||
SafeApp = apps.get_model("safe_apps", "SafeApp") | ||
default_icon_url = "safe_apps/icon_url.jpg" | ||
|
||
SafeApp.objects.filter(Q(icon_url__isnull=True) | Q(icon_url="")).update( | ||
icon_url=default_icon_url | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("safe_apps", "0012_rename_visible_safeapp_listed"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
assign_missing_default_icon_url, reverse_code=migrations.RunPython.noop | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.6 on 2024-05-31 14:46 | ||
|
||
from django.db import migrations, models | ||
|
||
import safe_apps.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("safe_apps", "0013_assign_safeapp_icon_url"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="safeapp", | ||
name="icon_url", | ||
field=models.ImageField( | ||
default="safe_apps/icon_url.jpg", | ||
max_length=255, | ||
upload_to=safe_apps.models.safe_app_icon_path, | ||
validators=[safe_apps.models.validate_safe_app_icon_size], | ||
), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from django.db.migrations.state import StateApps | ||
|
||
from chains.migrations.tests.utils import TestMigrations | ||
|
||
|
||
class Migration0013TestCase(TestMigrations): | ||
migrate_from = "0012_rename_visible_safeapp_listed" | ||
migrate_to = "0013_assign_safeapp_icon_url" | ||
|
||
def setUpBeforeMigration(self, apps: StateApps) -> None: | ||
SafeApp = apps.get_model("safe_apps", "SafeApp") | ||
SafeApp.objects.create( | ||
app_id=1, | ||
chain_ids=[1], | ||
description="No icon_url", | ||
) | ||
|
||
SafeApp.objects.create( | ||
app_id=2, | ||
chain_ids=[1], | ||
icon_url=None, | ||
description="Null icon_url", | ||
) | ||
|
||
SafeApp.objects.create( | ||
app_id=3, | ||
chain_ids=[1], | ||
icon_url="", | ||
description="Empty icon_url", | ||
) | ||
|
||
SafeApp.objects.create( | ||
app_id=4, | ||
chain_ids=[1], | ||
icon_url="existing/icon_url.jpg", | ||
description="Existing icon_url", | ||
) | ||
|
||
def test_icon_url_is_set(self) -> None: | ||
SafeApp = self.apps_registry.get_model("safe_apps", "SafeApp") | ||
|
||
app_1 = SafeApp.objects.get(app_id=1) | ||
app_2 = SafeApp.objects.get(app_id=2) | ||
app_3 = SafeApp.objects.get(app_id=3) | ||
app_4 = SafeApp.objects.get(app_id=4) | ||
|
||
self.assertEqual(app_1.icon_url.url, "/media/safe_apps/icon_url.jpg") | ||
self.assertEqual(app_2.icon_url.url, "/media/safe_apps/icon_url.jpg") | ||
self.assertEqual(app_3.icon_url.url, "/media/safe_apps/icon_url.jpg") | ||
self.assertEqual(app_4.icon_url.url, "/media/existing/icon_url.jpg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__name__ = "Safe Config Service" | ||
__version__ = "2.80.0" | ||
__version__ = "2.83.0" |