-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle testnet potfactory & pot contract patterns
- Loading branch information
1 parent
9b8e6e7
commit 9b12842
Showing
2 changed files
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
import re | ||
|
||
BASE_PATTERN = r"v\d+\.potfactory\.potlock\.near$" | ||
from django.conf import settings | ||
|
||
BASE_PATTERN = ( | ||
r"^potlock\.testnet$" | ||
if settings.ENVIRONMENT == "testnet" | ||
else r"v\d+\.potfactory\.potlock\.near$" | ||
) | ||
|
||
def match_pot_factory_version_pattern(receiver): | ||
|
||
def match_pot_factory_pattern(receiver): | ||
"""Matches the base pot factory version pattern without a subaccount. NB: does not currently handle testnet factory.""" | ||
pattern = f"^{BASE_PATTERN}" | ||
return bool(re.match(pattern, receiver)) | ||
|
||
|
||
def match_pot_subaccount_version_pattern(receiver): | ||
def match_pot_subaccount_pattern(receiver): | ||
"""Matches the pot factory version pattern with a subaccount. NB: does not currently handle testnet factory.""" | ||
pattern = f"^[a-zA-Z0-9_]+\.{BASE_PATTERN}" | ||
return bool(re.match(pattern, receiver)) |