Skip to content

Commit

Permalink
fix testnet pot deployment, add cors allow
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheo committed Aug 28, 2024
1 parent 985d1ef commit a3556fc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
32 changes: 23 additions & 9 deletions base/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,29 @@

WSGI_APPLICATION = "base.wsgi.application"

CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"https://alpha.potlock.io",
"https://alpha.potlock.org",
"https://alpha.potlock.xyz",
"https://alpha.potlock.app", # regex matching might not be advisable.
"http://dev.local",
"https://dev.local",
]

if ENVIRONMENT == "testnet":
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"https://test.potlock.org",
"https://test.potlock.xyz",
"https://test.potlock.io",
"https://test.potlock.app",
"https://testnet.potlock.org",
"https://testnet.potlock.xyz",
"https://testnet.potlock.app",
"https://testnet.potlock.io"
]
else:
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"https://alpha.potlock.io",
"https://alpha.potlock.org",
"https://alpha.potlock.xyz",
"https://alpha.potlock.app", # regex matching might not be advisable.
"http://dev.local",
"https://dev.local",
]

CORS_ALLOWED_ORIGIN_REGEXES = [
"^https:\/\/potlock-next-[\w-]+-potlock\.vercel\.app\/?$"
Expand Down
2 changes: 1 addition & 1 deletion indexer_app/management/commands/populatedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def handle(self, *args, **options):
if config.get("chef"):
chef, _ = Account.objects.get_or_create(defaults={"chain_id":1},id=config["chef"])
pot_defaults = {
"pot_factory_account": POTFACTORY_ID,
"pot_factory_id": POTFACTORY_ID,
"owner_id": config["owner"],
"chef_id": config["chef"],
"name": config["pot_name"],
Expand Down
4 changes: 2 additions & 2 deletions indexer_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def handle_new_pot(
# Create Pot object
logger.info(f"creating pot with owner {owner_id}....")
pot_defaults = {
"pot_factory_account": predecessorId,
"pot_factory_id": predecessorId,
"deployer": signer,
"deployed_at": created_at,
"source_metadata": data["source_metadata"],
Expand All @@ -174,7 +174,7 @@ async def handle_new_pot(
"registry_provider": data["registry_provider"],
"min_matching_pool_donation_amount": data[
"min_matching_pool_donation_amount"
],
] or "0",
"sybil_wrapper_provider": data["sybil_wrapper_provider"],
"custom_sybil_checks": data.get("custom_sybil_checks"),
"custom_min_threshold_score": data.get("custom_min_threshold_score"),
Expand Down
2 changes: 1 addition & 1 deletion pots/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.conf import settings

BASE_PATTERN = (
r"potlock\.testnet"
r"v\d+\.potfactory\.potlock\.testnet"
if settings.ENVIRONMENT == "testnet"
else r"v\d+\.potfactory\.potlock\.near"
)
Expand Down

0 comments on commit a3556fc

Please sign in to comment.