diff --git a/.env-sample b/.env-sample index 01833bfc..50e2231e 100644 --- a/.env-sample +++ b/.env-sample @@ -18,6 +18,8 @@ MARKET_PRICE_APIS = https://blockchain.info/ticker, https://api.yadio.io/exrates # Host e.g. robosats.com HOST_NAME = '' +HOST_NAME2 = '' +LOCAL_ALIAS = 'e.g:my_garbage_server' # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-6^&6uw$b5^en%(cu2kc7_o)(mgpazx#j_znwlym0vxfamn2uo-' @@ -68,4 +70,4 @@ PROPORTIONAL_ROUTING_FEE_LIMIT = 0.0002 MIN_FLAT_ROUTING_FEE_LIMIT = 10 # Username for HTLCs escrows -ESCROW_USERNAME = 'admin' \ No newline at end of file +ESCROW_USERNAME = 'admin' diff --git a/Dockerfile b/Dockerfile index 3b1ed2ad..52c08374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -FROM python:3.9 +FROM python:3.10.2-bullseye RUN mkdir -p /usr/src/robosats # specifying the working dir inside the container WORKDIR /usr/src/robosats +RUN python -m pip install --upgrade pip + COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt @@ -30,4 +32,4 @@ RUN sed -i 's/^import .*_pb2 as/from . \0/' api/lightning/invoices_pb2_grpc.py EXPOSE 8000 -CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file +CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/api/logics.py b/api/logics.py index 066dc8f3..6ffc5c48 100644 --- a/api/logics.py +++ b/api/logics.py @@ -439,6 +439,7 @@ class Logics(): elif order.status in [Order.Status.PUB, Order.Status.TAK, Order.Status.WF2, Order.Status.WFE] and order.maker == user: #Settle the maker bond (Maker loses the bond for canceling an ongoing trade) valid = cls.settle_bond(order.maker_bond) + cls.return_bond(order.taker_bond) # returns taker bond if valid: order.status = Order.Status.UCA order.save() @@ -861,4 +862,4 @@ class Logics(): def rate_platform(cls, user, rating): user.profile.platform_rating = rating user.profile.save() - return True, None \ No newline at end of file + return True, None diff --git a/api/views.py b/api/views.py index 8c29d2d4..f14824f8 100644 --- a/api/views.py +++ b/api/views.py @@ -508,7 +508,7 @@ class InfoView(ListAPIView): for tick in queryset: weighted_premiums.append(tick.premium*tick.volume) volumes.append(tick.volume) - + total_volume = sum(volumes) # Avg_premium is the weighted average of the premiums by volume avg_premium = sum(weighted_premiums) / total_volume diff --git a/requirements.txt b/requirements.txt index eef380a0..4caff079 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,11 +13,11 @@ celery==5.2.3 googleapis-common-protos==1.53.0 grpcio==1.43.0 grpcio-tools==1.43.0 -numpy==1.22.0 +numpy==1.22.2 Pillow==7.0.0 python-decouple==3.5 requests==2.22.0 ring==0.9.1 robohash==1.1 -scipy==1.7.3 +scipy==1.8.0 gunicorn==20.1.0 diff --git a/robosats/settings.py b/robosats/settings.py index eecf89a4..a80875a9 100644 --- a/robosats/settings.py +++ b/robosats/settings.py @@ -36,7 +36,7 @@ if os.environ.get('DEVELOPMENT'): AVATAR_ROOT = STATIC_ROOT + 'assets/avatars/' -ALLOWED_HOSTS = [config('HOST_NAME'),'127.0.0.1'] +ALLOWED_HOSTS = [config('HOST_NAME'),config('HOST_NAME2'),config('LOCAL_ALIAS'),'127.0.0.1'] # Application definition