fixed variable naming

This commit is contained in:
stubbsta 2024-03-19 14:16:39 +02:00
parent ade94d328b
commit 9c6d4cea12
No known key found for this signature in database

View File

@ -14,28 +14,28 @@ curl -o "$waku_rln_registry_impl_json" "$repo_url$waku_rln_registry_impl_json"
curl -o "$waku_rln_registry_proxy_json" "$repo_url$waku_rln_registry_proxy_json"
json_contents=$(cat $poseidon_hasher_json)
poseidon_hasher_bytecodeA=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
poseidon_hasher_bytecode=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
json_contents=$(cat $waku_rln_registry_impl_json)
waku_rln_registry_impl_bytecodeA=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
waku_rln_registry_impl_bytecode=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
json_contents=$(cat $waku_rln_registry_proxy_json)
waku_rln_registry_proxy_bytecodeA=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
waku_rln_registry_proxy_bytecode=$(echo "$json_contents" | grep -o 'bytecode\\"[^,]*' | awk -F '0x' '{print "0x" substr($2, 1, length($2)-2)}')
echo "Deploying RLN contracts..."
# 2. Deploy Poseidon Hasher
poseidon_address=$(cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY --create $poseidon_hasher_bytecodeA | grep contractAddress | cut -d' ' -f10)
poseidon_address=$(cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY --create $poseidon_hasher_bytecode | grep contractAddress | cut -d' ' -f10)
# 3. Deploy Waku Rln Registry Implementation
implementation_address=$(cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY --create $waku_rln_registry_impl_bytecodeA | grep contractAddress | cut -d' ' -f10)
implementation_address=$(cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY --create $waku_rln_registry_impl_bytecode | grep contractAddress | cut -d' ' -f10)
# 4. Concatenate Waku Rln Registry Proxy Bytecode with constructor arguments in the form of
# constructor(address implementation, bytes memory data)
# where data = abi.encodeWithSignature("initialize(address)", address(poseidonHasher))
constructor_arguments=$(cast abi-encode "constructor(address impl, bytes data)" "$implementation_address" $(cast calldata "initialize(address)" "$poseidon_address") | cut -c 3-)
waku_rln_registry_proxy_bytecode_with_constructor_arguments="$waku_rln_registry_proxy_bytecodeA$constructor_arguments"
waku_rln_registry_proxy_bytecode_with_constructor_arguments="$waku_rln_registry_proxy_bytecode$constructor_arguments"
# 5. Deploy Waku Rln Registry Proxy
waku_rln_registry_proxy_address=$(cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY --create $waku_rln_registry_proxy_bytecode_with_constructor_arguments | grep contractAddress | cut -d' ' -f10)