Skip to content

Commit c10ed44

Browse files
authored
Merge pull request #184 from PotLock/testnet
Testnet -> dev
2 parents 378ea96 + 0feae39 commit c10ed44

16 files changed

+1091
-438
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ media/
6565
# Celery beat schedule file
6666
celerybeat-schedule
6767
dump.rdb
68+
celerybeat-schedule.db
6869

6970
# Flask stuff:
7071
instance/
@@ -135,3 +136,5 @@ dmypy.json
135136
# static
136137

137138
/static/
139+
140+
.DS_Store

base/celery.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
app.autodiscover_tasks()
2626

2727
app.conf.beat_schedule = {
28-
"update_account_statistics_every_5_minutes": {
29-
"task": "indexer_app.tasks.update_account_statistics",
30-
"schedule": crontab(minute="*/5"), # Executes every 5 minutes
31-
"options": {"queue": "beat_tasks"},
32-
},
33-
"fetch_usd_prices_every_5_minutes": {
34-
"task": "indexer_app.tasks.fetch_usd_prices",
35-
"schedule": crontab(minute="*/5"), # Executes every 5 minutes
36-
"options": {"queue": "beat_tasks"},
37-
},
38-
"update_pot_statistics_every_5_minutes": {
39-
"task": "indexer_app.tasks.update_pot_statistics",
40-
"schedule": crontab(minute="*/5"), # Executes every 5 minutes
41-
"options": {"queue": "beat_tasks"},
42-
},
28+
# "update_account_statistics_every_5_minutes": {
29+
# "task": "indexer_app.tasks.update_account_statistics",
30+
# "schedule": crontab(minute="*/5"), # Executes every 5 minutes
31+
# "options": {"queue": "beat_tasks"},
32+
# },
33+
# "fetch_usd_prices_every_5_minutes": {
34+
# "task": "indexer_app.tasks.fetch_usd_prices",
35+
# "schedule": crontab(minute="*/5"), # Executes every 5 minutes
36+
# "options": {"queue": "beat_tasks"},
37+
# },
38+
# "update_pot_statistics_every_5_minutes": {
39+
# "task": "indexer_app.tasks.update_pot_statistics",
40+
# "schedule": crontab(minute="*/5"), # Executes every 5 minutes
41+
# "options": {"queue": "beat_tasks"},
42+
# },
4343
"fetch_stellar_events_every_minute": {
4444
"task": "indexer_app.tasks.stellar_event_indexer",
4545
"schedule": crontab(minute="*/1"), # Executes every 1 minutes

base/settings.py

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@
2828

2929
# SECURITY WARNING: keep the secret key used in production secret!
3030
# TODO: update before prod release
31-
SECRET_KEY = os.environ.get("PL_DJANGO_SECRET_KEY", "django-insecure-=r_v_es6w6rxv42^#kc2hca6p%=fe_*cog_5!t%19zea!enlju")
31+
SECRET_KEY = os.environ.get(
32+
"PL_DJANGO_SECRET_KEY",
33+
"django-insecure-=r_v_es6w6rxv42^#kc2hca6p%=fe_*cog_5!t%19zea!enlju",
34+
)
3235

3336
ALLOWED_HOSTS = [
3437
"ec2-100-27-57-47.compute-1.amazonaws.com",
3538
"ec2-44-208-38-31.compute-1.amazonaws.com",
3639
"127.0.0.1",
3740
"dev.potlock.io",
3841
"test-dev.potlock.io",
39-
"api.potlock.io"
42+
"api.potlock.io",
4043
# "alpha.potlock.io",
4144
]
4245

@@ -62,28 +65,45 @@
6265
RECLAIM_APP_ID = os.environ.get("PL_RECLAIM_APP_ID")
6366
RECLAIM_APP_SECRET = os.environ.get("PL_RECLAIM_APP_SECRET")
6467
RECLAIM_TWITTER_PROVIDER_ID = os.environ.get("PL_RECLAIM_TWITTER_PROVIDER_ID")
65-
INDEXER_STREAMER_WAIT_TIME = os.environ.get("PL_INDEXER_STREAMER_WAIT_TIME", 300) # in seconds
68+
INDEXER_STREAMER_WAIT_TIME = os.environ.get(
69+
"PL_INDEXER_STREAMER_WAIT_TIME", 300
70+
) # in seconds
6671

6772
# POTLOCK_TLA = "potlock.testnet" if ENVIRONMENT == "testnet" else "potlock.near"
68-
POTLOCK_TLA = "potlock.testnet" if ENVIRONMENT == "testnet" else ("staging.potlock.near" if ENVIRONMENT == "dev" else "potlock.near")
73+
POTLOCK_TLA = (
74+
"potlock.testnet"
75+
if ENVIRONMENT == "testnet"
76+
else ("staging.potlock.near" if ENVIRONMENT == "dev" else "potlock.near")
77+
)
6978
# NADABOT_TLA = "nadabot.testnet" if ENVIRONMENT == "testnet" else "nadabot.near"
70-
NADABOT_TLA = "nadabot.testnet" if ENVIRONMENT == "testnet" else ("staging.nadabot.near" if ENVIRONMENT == "dev" else "nadabot.near")
79+
NADABOT_TLA = (
80+
"nadabot.testnet"
81+
if ENVIRONMENT == "testnet"
82+
else ("staging.nadabot.near" if ENVIRONMENT == "dev" else "nadabot.near")
83+
)
7184
STELLAR_CONTRACT_ID = os.environ.get("PL_STELLAR_CONTRACT_ID", "")
72-
STELLAR_PROJECTS_REGISTRY_CONTRACT = os.environ.get("PL_STELLAR_PROJECTS_REGISTRY_CONTRACT", "")
85+
STELLAR_PROJECTS_REGISTRY_CONTRACT = os.environ.get(
86+
"PL_STELLAR_PROJECTS_REGISTRY_CONTRACT", ""
87+
)
88+
STELLAR_LIST_CONTRACT = os.environ.get("PL_STELLAR_LIST_CONTRACT", "")
7389
NEAR_SOCIAL_CONTRACT_ADDRESS = (
7490
"v1.social08.testnet" if ENVIRONMENT == "testnet" else "social.near"
7591
)
76-
NEAR_GRANTPICKS_CONTRACT_ID = "v2.grantpicks.potlock.testnet" if ENVIRONMENT == "testnet" else ("" if ENVIRONMENT == "dev" else "")
92+
NEAR_GRANTPICKS_CONTRACT_ID = (
93+
"v2.grantpicks.potlock.testnet"
94+
if ENVIRONMENT == "testnet"
95+
else ("" if ENVIRONMENT == "dev" else "")
96+
)
7797
# TODO: split settigns file by enviroment
7898
if ENVIRONMENT == "testnet":
79-
POTLOCK_PATTERN = r'\.potlock\.testnet$'
80-
NADABOT_PATTERN = r'\.nadabot\.testnet$'
99+
POTLOCK_PATTERN = r"\.potlock\.testnet$"
100+
NADABOT_PATTERN = r"\.nadabot\.testnet$"
81101
elif ENVIRONMENT == "dev":
82-
POTLOCK_PATTERN = r'\.staging\.potlock\.near$'
83-
NADABOT_PATTERN = r'\.staging\.nadabot\.near$'
102+
POTLOCK_PATTERN = r"\.staging\.potlock\.near$"
103+
NADABOT_PATTERN = r"\.staging\.nadabot\.near$"
84104
else: # mainnet/prod
85-
POTLOCK_PATTERN = r'(?<!\.staging)\.potlock\.near$'
86-
NADABOT_PATTERN = r'(?<!\.staging)\.nadabot\.near$'
105+
POTLOCK_PATTERN = r"(?<!\.staging)\.potlock\.near$"
106+
NADABOT_PATTERN = r"(?<!\.staging)\.nadabot\.near$"
87107

88108
FASTNEAR_RPC_URL = (
89109
"https://rpc.web4.testnet.page"
@@ -133,7 +153,7 @@
133153
"nadabot",
134154
"chains",
135155
"grantpicks",
136-
"campaigns"
156+
"campaigns",
137157
]
138158

139159
DEFAULT_PAGE_SIZE = 30
@@ -205,7 +225,7 @@
205225
"https://testnet.potlock.org",
206226
"https://testnet.potlock.xyz",
207227
"https://testnet.potlock.app",
208-
"https://testnet.potlock.io"
228+
"https://testnet.potlock.io",
209229
]
210230
elif ENVIRONMENT == "dev":
211231
CORS_ALLOWED_ORIGINS = [
@@ -216,6 +236,9 @@
216236
"https://dev.local",
217237
"https://app.potlock.app",
218238
"https://app.potlock.org",
239+
"http://alpha.potlock.org",
240+
"https://alpha.potlock.xyz",
241+
"https://alpha.potlock.app",
219242
]
220243
else:
221244
CORS_ALLOWED_ORIGINS = [
@@ -242,14 +265,14 @@
242265
"https://bos.potlock.io",
243266
"https://app.potlock.io",
244267
"https://bos.potlock.app",
245-
"https://app.potlock.app"
268+
"https://app.potlock.app",
246269
]
247270

248271
CORS_ALLOWED_ORIGIN_REGEXES = [
249272
"^https:\/\/potlock-next-[\w-]+-potlock\.vercel\.app\/?$",
250273
"^https?:\/\/.*\.?grantpicks\.com$",
251274
"^https:\/\/staging\.app\.potlock\.(org|io|xyz|app)\/?$",
252-
"^https:\/\/staging\.alpha\.potlock\.(org|io|xyz|app)\/?$"
275+
"^https:\/\/staging\.alpha\.potlock\.(org|io|xyz|app)\/?$",
253276
]
254277

255278
# REDIS / CACHE CONFIGS

grantpicks/api.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class RoundsListAPI(APIView, CustomSizePageNumberPagination):
8383
500: OpenApiResponse(description="Internal server error"),
8484
},
8585
)
86-
@method_decorator(cache_page(60 * 1))
8786
def get(self, request: Request, *args, **kwargs):
8887
account_id = kwargs.get("account_id")
8988
if account_id:
@@ -136,11 +135,10 @@ class RoundDetailAPI(APIView):
136135
404: OpenApiResponse(description="Round not found"),
137136
},
138137
)
139-
@method_decorator(cache_page(60 * 1))
140138
def get(self, request: Request, *args, **kwargs):
141139
round_id = kwargs.get("round_id")
142140
try:
143-
round = Round.objects.get(id=round_id)
141+
round = Round.objects.get(on_chain_id=round_id)
144142
except Round.DoesNotExist:
145143
return Response({"message": f"Round with ID {round_id} not found."}, status=404)
146144
serializer = RoundSerializer(round)
@@ -171,11 +169,10 @@ class RoundApplicationsAPI(APIView, CustomSizePageNumberPagination):
171169
404: OpenApiResponse(description="Round not found"),
172170
},
173171
)
174-
@method_decorator(cache_page(60 * 1))
175172
def get(self, request: Request, *args, **kwargs):
176173
round_id = kwargs.get("round_id")
177174
try:
178-
round = Round.objects.get(id=round_id)
175+
round = Round.objects.get(on_chain_id=round_id)
179176
except Round.DoesNotExist:
180177
return Response({"message": f"Round with ID {round_id} not found."}, status=404)
181178

@@ -210,12 +207,11 @@ class ProjectRoundVotesAPI(APIView, CustomSizePageNumberPagination):
210207
404: OpenApiResponse(description="Round or project not found"),
211208
},
212209
)
213-
@method_decorator(cache_page(60 * 1))
214210
def get(self, request: Request, *args, **kwargs):
215211
round_id = kwargs.get("round_id")
216212
project_id = kwargs.get("project_id") # Get project_id from kwargs
217213
try:
218-
round_obj = Round.objects.get(id=round_id)
214+
round_obj = Round.objects.get(on_chain_id=round_id)
219215
# project = Project.objects.get(id=project_id) # comment out now, might use later if decide to return vote pairs instead
220216
except Round.DoesNotExist:
221217
return Response({"message": f"Round with ID {round_id} not found."}, status=404)
@@ -278,7 +274,7 @@ class ProjectListAPI(APIView, CustomSizePageNumberPagination):
278274
500: OpenApiResponse(description="Internal server error"),
279275
},
280276
)
281-
@method_decorator(cache_page(60 * 5))
277+
@method_decorator(cache_page(60 * 2))
282278
def get(self, request: Request, *args, **kwargs):
283279
projects = Project.objects.all()
284280
status_param = request.query_params.get("status")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.0.6 on 2025-10-10 22:17
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("grantpicks", "0009_round_minimum_deposit"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="project",
15+
name="video_url",
16+
field=models.URLField(blank=True, null=True),
17+
),
18+
]

0 commit comments

Comments
 (0)