Skip to content

Commit 19cbea7

Browse files
authored
Merge pull request #185 from PotLock/testnet
Testnet -> staging
2 parents c10ed44 + 6295826 commit 19cbea7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

indexer_app/utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
from typing import Dict
66

77
import requests
8+
import stellar_sdk
89
from asgiref.sync import sync_to_async
910
from django.conf import settings
1011
from django.core.cache import cache
1112
from django.db import transaction
1213
from django.utils import timezone
1314
from near_lake_framework.near_primitives import ExecutionOutcome, Receipt
14-
import stellar_sdk
1515

1616
from accounts.models import Account
1717
from activities.models import Activity
@@ -1462,7 +1462,7 @@ def update_approved_projects(
14621462

14631463

14641464
def update_application(event_data, txhash, reviewer_id=None, chain_id="stellar"):
1465-
if type(event_data) == list:
1465+
if isinstance(event_data, list):
14661466
round_id, application_data, reviewer_id = (
14671467
event_data[0],
14681468
event_data[1],
@@ -1540,8 +1540,8 @@ def get_pair_projects(pair_id: int, round_id: int, chain_id: str) -> Dict:
15401540
if chain_id == "stellar":
15411541
server = stellar_sdk.SorobanServer(
15421542
"https://soroban-testnet.stellar.org"
1543-
if settings.ENVIRONMENT == "testnet" or settings.ENVIRONMENT == "local"
1544-
else "https://horizon.stellar.org"
1543+
if settings.ENVIRONMENT == "testnet"
1544+
else "https://rpc.lightsail.network"
15451545
)
15461546

15471547
contract_id = settings.STELLAR_CONTRACT_ID
@@ -1550,7 +1550,8 @@ def get_pair_projects(pair_id: int, round_id: int, chain_id: str) -> Dict:
15501550
stellar_sdk.scval.to_uint128(round_id),
15511551
stellar_sdk.scval.to_uint32(pair_id),
15521552
]
1553-
public_key = "GAA3KC7HAHPZ2OGSAV5WBOFCJ3NSSPHKCYZAEI36DQJP2EB2FCGKSEFB" # TODO: move to settings
1553+
# TODO: move to settings
1554+
public_key = "GAA3KC7HAHPZ2OGSAV5WBOFCJ3NSSPHKCYZAEI36DQJP2EB2FCGKSEFB"
15541555
acct = server.load_account(public_key)
15551556

15561557
pair_result = server.simulate_transaction(
@@ -1581,7 +1582,7 @@ def process_vote_event(event_data, tx_hash, chain_id="stellar"):
15811582
try:
15821583
logger.info(f"process_vote_event: {event_data}, {tx_hash}, {chain_id}")
15831584
with transaction.atomic():
1584-
if type(event_data) == list:
1585+
if isinstance(event_data, list):
15851586
round_id, vote_data = event_data[0], event_data[1]
15861587
else:
15871588
# vote_event_data = event_data['vote']
@@ -2165,7 +2166,7 @@ def handle_new_stellar_list_registration(
21652166
defaults = {
21662167
"signer_id": data["registered_by"],
21672168
"receiver_id": contract_id,
2168-
"timestamp": data["submitted_ms"],
2169+
"timestamp": datetime.fromtimestamp(data["submitted_ms"] / 1000),
21692170
"tx_hash": tx_hash,
21702171
}
21712172

@@ -2380,12 +2381,14 @@ async def handle_update_campaign(data: dict):
23802381
logger.error(f"Failed to update campaign: {e}")
23812382

23822383

2383-
async def handle_delete_campaign(campaign_id: int):
2384+
async def handle_delete_campaign(data: dict):
23842385
"""
23852386
Index a campaign deletion event.
23862387
campaign_id: on_chain_id of the campaign to delete
23872388
"""
23882389

2390+
campaign_id = data["campaign_id"]
2391+
23892392
try:
23902393
logger.info(f"Deleting campaign: {campaign_id}")
23912394

lists/api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class ListsListAPI(APIView, CustomSizePageNumberPagination):
7474
500: OpenApiResponse(description="Internal server error"),
7575
},
7676
)
77-
@method_decorator(cache_page(60 * 1))
7877
def get(self, request: Request, *args, **kwargs):
7978
lists = List.objects.all().select_related("owner").prefetch_related("admins", "upvotes").annotate(registrations_count=Count('registrations'))
8079
account_id = request.query_params.get("account")
@@ -140,7 +139,7 @@ class ListDetailAPI(APIView):
140139
500: OpenApiResponse(description="Internal server error"),
141140
},
142141
)
143-
@method_decorator(cache_page(60 * 5))
142+
@method_decorator(cache_page(60 * 3))
144143
def get(self, request: Request, *args, **kwargs):
145144
list_id = kwargs.get("list_id")
146145
chain = request.query_params.get("chain")
@@ -203,7 +202,6 @@ class ListRegistrationsAPI(APIView, CustomSizePageNumberPagination):
203202
500: OpenApiResponse(description="Internal server error"),
204203
},
205204
)
206-
@method_decorator(cache_page(60 * 1))
207205
def get(self, request: Request, *args, **kwargs):
208206
list_id = kwargs.get("list_id")
209207
chain = request.query_params.get("chain")

0 commit comments

Comments
 (0)