mirror of
https://github.com/logos-messaging/logos-messaging-nim-compose.git
synced 2026-01-03 22:43:07 +00:00
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if test -f ./keystore/keystore.json; then
|
|
echo "keystore/keystore.json already exists. Use it instead of creating a new one."
|
|
echo "Exiting"
|
|
exit 1
|
|
fi
|
|
|
|
if test -f .env; then
|
|
echo "Using .env file"
|
|
. "$(pwd)"/.env
|
|
fi
|
|
|
|
if test -n "${ETH_CLIENT_ADDRESS}"; then
|
|
echo "ETH_CLIENT_ADDRESS variable was renamed to RLN_RELAY_ETH_CLIENT_ADDRESS"
|
|
echo "Please update your .env file"
|
|
exit 1
|
|
fi
|
|
|
|
# Ensure Foundry (cast & foundryup) is available for token approve calls
|
|
if ! command -v cast >/dev/null 2>&1; then
|
|
echo "Foundry toolkit (cast) not found. Installing Foundry..."
|
|
curl -L https://foundry.paradigm.xyz | bash
|
|
# Make the freshly installed binaries available in the current session
|
|
export PATH="$HOME/.foundry/bin:$PATH"
|
|
foundryup
|
|
fi
|
|
|
|
# default: do approve
|
|
NEED_APPROVAL=1
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--no-approve) NEED_APPROVAL=0 ;;
|
|
--approve) NEED_APPROVAL=1 ;;
|
|
esac
|
|
done
|
|
|
|
RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6
|
|
TST_AMOUNT_WEI=500000000000000000
|
|
|
|
# Approve
|
|
if [ "$NEED_APPROVAL" = "1" ]; then
|
|
echo "Approve to spend TestStableToken"
|
|
if ! cast send "$TOKEN_CONTRACT_ADDRESS" "approve(address,uint256)" \
|
|
"$RLN_CONTRACT_ADDRESS" "$TST_AMOUNT_WEI" \
|
|
--private-key "$ETH_TESTNET_KEY" \
|
|
--rpc-url "$RLN_RELAY_ETH_CLIENT_ADDRESS"
|
|
then
|
|
echo "Approve transaction failed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
docker run -v "$(pwd)/keystore":/keystore/:Z harbor.status.im/wakuorg/nwaku:v0.37.0-beta generateRlnKeystore \
|
|
--rln-relay-eth-client-address=${RLN_RELAY_ETH_CLIENT_ADDRESS} \
|
|
--rln-relay-eth-private-key=${ETH_TESTNET_KEY} \
|
|
--rln-relay-eth-contract-address=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 \
|
|
--rln-relay-cred-path=/keystore/keystore.json \
|
|
--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}" \
|
|
--rln-relay-user-message-limit=100 \
|
|
--rln-relay-chain-id=59141 \
|
|
--execute
|