Skip to content

Commit

Permalink
Merge pull request #37 from CirclesUBI/rebase-upstream
Browse files Browse the repository at this point in the history
Rebase to latest gnosis version
  • Loading branch information
adzialocha authored Feb 19, 2021
2 parents 457be87 + 4fdca60 commit 9d50d07
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 39 deletions.
41 changes: 21 additions & 20 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls import include
from django.contrib import admin
from django.http import HttpResponse
from django.urls import re_path
from django.views import defaults as default_views
from django.views.decorators.cache import cache_control

Expand All @@ -26,46 +27,46 @@
schema_cache_decorator = cache_control(max_age=schema_cache_timeout)

urlpatterns = [
url(r'^$',
schema_cache_decorator(schema_view.with_ui('swagger', cache_timeout=0)),
name='schema-swagger-ui'),
url(r'^swagger(?P<format>\.json|\.yaml)$',
schema_cache_decorator(schema_view.without_ui(cache_timeout=schema_cache_timeout)),
name='schema-json'),
url(r'^redoc/$',
schema_cache_decorator(schema_view.with_ui('redoc', cache_timeout=schema_cache_timeout)),
name='schema-redoc'),
url(settings.ADMIN_URL, admin.site.urls),
url(r'^api/v1/', include('safe_relay_service.relay.urls', namespace='v1')),
url(r'^api/v2/', include('safe_relay_service.relay.urls_v2', namespace='v2')),
url(r'^api/v3/', include('safe_relay_service.relay.urls_v3', namespace='v3')),
url(r'^check/', lambda request: HttpResponse("Ok"), name='check'),
re_path(r'^$',
schema_cache_decorator(schema_view.with_ui('swagger', cache_timeout=0)),
name='schema-swagger-ui'),
re_path(r'^swagger(?P<format>\.json|\.yaml)$',
schema_cache_decorator(schema_view.without_ui(cache_timeout=schema_cache_timeout)),
name='schema-json'),
re_path(r'^redoc/$',
schema_cache_decorator(schema_view.with_ui('redoc', cache_timeout=schema_cache_timeout)),
name='schema-redoc'),
re_path(settings.ADMIN_URL, admin.site.urls),
re_path(r'^api/v1/', include('safe_relay_service.relay.urls', namespace='v1')),
re_path(r'^api/v2/', include('safe_relay_service.relay.urls_v2', namespace='v2')),
re_path(r'^api/v3/', include('safe_relay_service.relay.urls_v3', namespace='v3')),
re_path(r'^check/', lambda request: HttpResponse("Ok"), name='check'),
]

if settings.DEBUG:
# This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like.
urlpatterns += [
url(
re_path(
r"^400/$",
default_views.bad_request,
kwargs={"exception": Exception("Bad Request!")},
),
url(
re_path(
r"^403/$",
default_views.permission_denied,
kwargs={"exception": Exception("Permission Denied")},
),
url(
re_path(
r"^404/$",
default_views.page_not_found,
kwargs={"exception": Exception("Page not Found")},
),
url(r"^500/$", default_views.server_error),
re_path(r"^500/$", default_views.server_error),
]
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar

urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns
urlpatterns = [re_path(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns

admin.autodiscover()
28 changes: 14 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
cachetools==4.1.1
celery==4.4.7
cachetools==4.2.1
celery==5.0.5
django-authtools==1.7.0
django-celery-beat==2.0.0
django-celery-beat==2.2.0
django-cors-headers==3.5.0
django-debug-toolbar
django-debug-toolbar-force
django-environ==0.4.5
django-filter==2.4.0
django-model-utils==4.0.0
django-model-utils==4.1.1
django-redis==4.12.1
django-timezone-field==4.0
django==3.1.2
django-timezone-field==4.1.1
django==3.1.6
djangorestframework-camel-case==1.2.0
djangorestframework==3.11.2
djangorestframework==3.12.2
docutils==0.16
drf-yasg[validation]==1.17.1
drf-yasg[validation]==1.20.0
ethereum==2.3.2
gnosis-py==2.6.9
gnosis-py==2.7.6
gunicorn[gevent]==20.0.4
hexbytes==0.2.1
lxml==4.5.2
numpy==1.19.2
packaging==20.4
lxml==4.6.2
numpy==1.20.0
packaging==20.9
psycopg2-binary==2.8.6
redis==3.5.3
requests==2.24.0
requests==2.25.1
sgqlc==11.0
web3==5.12.2
web3==5.16.0
18 changes: 18 additions & 0 deletions safe_relay_service/relay/migrations/0029_auto_20201102_1643.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.2 on 2020-11-02 16:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('relay', '0028_auto_20200922_1000'),
]

operations = [
migrations.AlterField(
model_name='ethereumevent',
name='arguments',
field=models.JSONField(),
),
]
6 changes: 3 additions & 3 deletions safe_relay_service/relay/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models import (Avg, Case, Count, DurationField, F, Q, Sum,
Value, When)
from django.db.models import (Avg, Case, Count, DurationField, F, JSONField, Q,
Sum, Value, When)
from django.db.models.expressions import RawSQL, Subquery, Window
from django.db.models.functions import Cast, TruncDate
from django.utils import timezone
Expand Down
2 changes: 2 additions & 0 deletions safe_relay_service/tokens/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class TokenAdmin(admin.ModelAdmin):
readonly_fields = ('eth_value', 'price_oracle_ticker_pairs')

def eth_value(self, obj: Token):
if self.decimals is None: # Add token admin page
return .0
try:
return obj.get_eth_value()
except CannotGetTokenPriceFromApi:
Expand Down
18 changes: 18 additions & 0 deletions safe_relay_service/tokens/migrations/0014_auto_20201102_1643.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.2 on 2020-11-02 16:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('tokens', '0013_auto_20200217_0942'),
]

operations = [
migrations.AlterField(
model_name='priceoracle',
name='configuration',
field=models.JSONField(default=dict),
),
]
2 changes: 1 addition & 1 deletion safe_relay_service/tokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from urllib.parse import urljoin, urlparse

from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.db.models import JSONField

from gnosis.eth.django.models import EthereumAddressField

Expand Down
2 changes: 1 addition & 1 deletion safe_relay_service/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '3.12.0'
__version__ = '3.12.1'
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])

0 comments on commit 9d50d07

Please sign in to comment.