diff --git a/docker/Dockerfile.evmos-node.developer b/docker/Dockerfile.evmos-node.developer index 7733e221..3ef7b579 100644 --- a/docker/Dockerfile.evmos-node.developer +++ b/docker/Dockerfile.evmos-node.developer @@ -3,7 +3,7 @@ FROM ghcr.io/zama-ai/fhevm-decryptions-db:v0.1.5 as oracle-env FROM ghcr.io/zama-ai/fhevm-tfhe-cli:v0.1.2 as tfhe-cli -FROM ghcr.io/zama-ai/evmos-node:v0.1.7-beta +FROM ghcr.io/zama-ai/evmos-node:v0.1.7 WORKDIR /config @@ -12,7 +12,7 @@ ADD ./public.ed25519 . ADD ./scripts/prepare_volumes_from_fhe_tool.sh . ADD ./scripts/prepare_validator_ci.sh . ADD ./scripts/run_developer_image.sh . - +ADD --chmod=755 ./faucet.py /usr/local/bin/faucet COPY --from=oracle-env /usr/local/app/fhevm-decryptions-db . COPY --from=oracle-env /usr/local/app/Rocket.toml . diff --git a/faucet.py b/faucet.py new file mode 100644 index 00000000..5f0f13ea --- /dev/null +++ b/faucet.py @@ -0,0 +1,34 @@ +#!/bin/env python3 + +import sys +import os +import subprocess +import json + +if len(sys.argv) < 2: + print('Pass address for tokens in the first argument') + +FAUCET_DEST_ADDRESS = sys.argv[1] +FAUCET_WALLET_NAME = os.getenv('FAUCET_WALLET_NAME', default='mykey1') +FAUCET_AMOUNT = os.getenv('FAUCET_AMOUNT', default='100000000000000000000') +DENOM = os.getenv('DENOM', default='aevmos') + +def get_faucet_address(): + addresses = json.loads(subprocess.check_output(['evmosd', '--output=json', 'keys', 'list'])) + for address in addresses: + if address['name'] == FAUCET_WALLET_NAME: + return address['address'] + return None + +def get_bech32_addr(ethereum_address): + output = subprocess.check_output(['evmosd', 'debug', 'addr', ethereum_address]).decode('utf-8') + bech32 = next((x for x in output.splitlines() if x.startswith('Bech32 Acc:'))) + return bech32.split(': ')[1] + +faucet_address = get_faucet_address() +if faucet_address is None: + print('Faucet account not found with name ' + FAUCET_WALLET_NAME) + os.exit(1) + +dst_bech_addr = get_bech32_addr(FAUCET_DEST_ADDRESS) +os.system(f'evmosd --output=json tx bank send {faucet_address} {dst_bech_addr} {FAUCET_AMOUNT}{DENOM} --from {FAUCET_WALLET_NAME} --gas-prices 1{DENOM} -y')