Skip to content

Commit

Permalink
#407 Don't create neon account if NEW_USER_AIRDROP_AMOUNT is zero (#408)
Browse files Browse the repository at this point in the history
Co-authored-by: ivanl <[email protected]>
  • Loading branch information
ivandzen and ivanl authored Dec 23, 2021
1 parent 2f4dde6 commit 8dc99fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion proxy/plugin/solana_rest_api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..common_neon.transaction_sender import TransactionSender
from ..common_neon.emulator_interactor import call_emulated
from ..common_neon.utils import get_from_dict
from ..environment import read_elf_params, TIMEOUT_TO_RELOAD_NEON_CONFIG, EXTRA_GAS
from ..environment import NEW_USER_AIRDROP_AMOUNT, read_elf_params, TIMEOUT_TO_RELOAD_NEON_CONFIG, EXTRA_GAS


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -104,6 +104,9 @@ def get_token_balance_or_airdrop(client: SolanaClient, signer: SolanaAccount, et
return get_token_balance_gwei(client, solana_account)
except SolanaAccountNotFoundError:
logger.debug(f"Account not found: {eth_account} aka: {solana_account} - create")
if NEW_USER_AIRDROP_AMOUNT == 0:
return 0

create_eth_account_and_airdrop(client, signer, eth_account)
return get_token_balance_gwei(client, solana_account)

Expand Down

0 comments on commit 8dc99fd

Please sign in to comment.