diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 5f2ac0ea..543e3c32 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -40,3 +40,4 @@ jobs: LIGHTNING_RPC_URL: https://api.lnpay.co/v1/ LIGHTNING_WALLET: ${{ secrets.LIGHTNING_WALLET }} LIGHTNING_FUND_MANAGER: ${{ secrets.LIGHTNING_FUND_MANAGER }} + DEPLOYMENT_ENV: "dev" diff --git a/brightIDfaucet/settings.py b/brightIDfaucet/settings.py index 3f6b9928..1c7f162c 100644 --- a/brightIDfaucet/settings.py +++ b/brightIDfaucet/settings.py @@ -68,6 +68,9 @@ def str2bool(v): MEMCACHED_URL = os.environ.get("MEMCACHEDCLOUD_SERVERS") MEMCACHED_USERNAME = os.environ.get("MEMCACHEDCLOUD_USERNAME") MEMCACHED_PASSWORD = os.environ.get("MEMCACHEDCLOUD_PASSWORD") +DEPLOYMENT_ENV = os.environ.get("DEPLOYMENT_ENV") + +assert DEPLOYMENT_ENV in ["dev", "main"] def before_send(event, hint): diff --git a/prizetap/constants.py b/prizetap/constants.py index e1cb393a..99928d78 100644 --- a/prizetap/constants.py +++ b/prizetap/constants.py @@ -1629,7 +1629,8 @@ }, ] -VRF_CLIENT_POLYGON_ADDRESS = "0xD1E7877A1C3F782dec76FB58C2B926365433d46F" +VRF_CLIENT_POLYGON_ADDRESS = "0xd713f3584EADc92848d64C31fD66CD50AdF272CD" +VRF_CLIENT_MUMBAI_ADDRESS = "0xD1E7877A1C3F782dec76FB58C2B926365433d46F" CONTRACT_ADDRESSES = { "137": { diff --git a/prizetap/tasks.py b/prizetap/tasks.py index 46733675..bfdc1d57 100644 --- a/prizetap/tasks.py +++ b/prizetap/tasks.py @@ -4,6 +4,7 @@ from celery import shared_task from django.utils import timezone +from brightIDfaucet.settings import DEPLOYMENT_ENV from core.helpers import memcache_lock from .models import Raffle @@ -41,9 +42,10 @@ def set_raffle_random_words(self): def set_random_words(raffle: Raffle): + app = "unitap" if DEPLOYMENT_ENV == "main" else "stage_unitap" muon_response = requests.get( ( - "https://shield.unitap.app/v1/?app=stage_unitap&method=random-words&" + f"https://shield.unitap.app/v1/?app={app}&method=random-words&" f"params[chainId]={raffle.chain.chain_id}¶ms[prizetapRaffle]={raffle.contract}&" f"params[raffleId]={raffle.raffleId}" ) diff --git a/prizetap/utils.py b/prizetap/utils.py index 4faa1adb..6c8b272b 100644 --- a/prizetap/utils.py +++ b/prizetap/utils.py @@ -1,5 +1,6 @@ import time +from brightIDfaucet.settings import DEPLOYMENT_ENV from core.utils import Web3Utils from faucet.models import Chain @@ -8,6 +9,7 @@ PRIZETAP_ERC721_ABI, UNITAP_PASS_ABI, VRF_CLIENT_ABI, + VRF_CLIENT_MUMBAI_ADDRESS, VRF_CLIENT_POLYGON_ADDRESS, ) @@ -61,7 +63,8 @@ def get_raffle_winners_count(self): class VRFClientContractClient(Web3Utils): def __init__(self, chain) -> None: super().__init__(chain.rpc_url_private, chain.poa) - self.set_contract(VRF_CLIENT_POLYGON_ADDRESS, VRF_CLIENT_ABI) + address = VRF_CLIENT_POLYGON_ADDRESS if DEPLOYMENT_ENV == "main" else VRF_CLIENT_MUMBAI_ADDRESS + self.set_contract(address, VRF_CLIENT_ABI) self.set_account(chain.wallet.private_key) def get_last_request_id(self): diff --git a/sample.env b/sample.env index ff5df3e3..825c75b7 100644 --- a/sample.env +++ b/sample.env @@ -6,3 +6,4 @@ SECRET_KEY="django-insecure-!=_mi0j#rhk7c9p-0wg-3me6y&fk$+fahz6fh)k1n#&@s(9vf5" BRIGHT_PRIVATE_KEY="" DEBUG="True" SENTRY_DSN="DEBUG-DSN" +DEPLOYMENT_ENV="env"