Deploy TST Proxy contract (#113)

* env updates and new deploy of TST

* Fix export parameter name in deply_rln_contracts

* Update docker-compose and deploy_rln_contracts

* Verify forge commands and addresses

* Fix command for DeployTokenWithProxy
This commit is contained in:
Tanya S 2025-10-03 13:00:27 +02:00 committed by GitHub
parent 1be2f90070
commit 68c6c0246a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 19 deletions

View File

@ -38,23 +38,66 @@ export API_KEY_ETHERSCAN=123
export API_KEY_CARDONA=123
export API_KEY_LINEASCAN=123
# 5. Deploy the TestToken
echo "\nDeploying TestToken (ERC20 Token Contract)...\n"
forge script test/TestToken.sol --broadcast -vv --rpc-url http://foundry:8545 --tc TestTokenFactory --private-key $PRIVATE_KEY
export TOKEN_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
# Helper function to validate Ethereum addresses
validate_address() {
local address="$1"
local name="$2"
if [ -z "$address" ]; then
echo "Error: Failed to extract $name address"
exit 1
fi
if ! echo "$address" | grep -qE "^0x[a-fA-F0-9]{40}$"; then
echo "Error: Invalid $name address format: $address"
exit 1
fi
echo "Successfully extracted $name address: $address"
}
echo "\nDeploying LinearPriceCalculator Contract..."
# 5. Deploy the TestToken Proxy with the TestToken implementation contracts
printf "\nDeploying TestToken Proxy (ERC20 Token Contract)...\n"
DEPLOY_TST_PROXY_OUTPUT=$(ETH_FROM=$ETH_FROM forge script script/DeployTokenWithProxy.s.sol:DeployTokenWithProxy --broadcast -vv --rpc-url http://foundry:8545 --private-key $PRIVATE_KEY)
if [ $? -ne 0 ]; then
echo "Error: TestToken Proxy deployment failed"
echo "Forge output: $DEPLOY_TST_PROXY_OUTPUT"
exit 1
fi
export PROXY_TOKEN_ADDRESS=$(echo "$DEPLOY_TST_PROXY_OUTPUT" | grep -o "0: address 0x[a-fA-F0-9]\{40\}" | head -n1 | cut -d' ' -f3)
validate_address "$PROXY_TOKEN_ADDRESS" "TestToken Proxy"
export TOKEN_ADDRESS=$PROXY_TOKEN_ADDRESS
printf "\nDeploying LinearPriceCalculator Contract...\n"
forge script script/Deploy.s.sol --broadcast -vv --rpc-url http://foundry:8545 --tc DeployPriceCalculator --private-key $PRIVATE_KEY
if [ $? -ne 0 ]; then
echo "Error: LinearPriceCalculator deployment failed"
exit 1
fi
echo "LinearPriceCalculator deployment completed successfully"
echo "\nDeploying RLN contract..."
printf "\nDeploying RLN contract...\n"
forge script script/Deploy.s.sol --broadcast -vv --rpc-url http://foundry:8545 --tc DeployWakuRlnV2 --private-key $PRIVATE_KEY
if [ $? -ne 0 ]; then
echo "Error: RLN contract deployment failed"
exit 1
fi
echo "RLN contract deployment completed successfully"
echo "\nDeploying Proxy contract..."
forge script script/Deploy.s.sol --broadcast -vvv --rpc-url http://foundry:8545 --tc DeployProxy --private-key $PRIVATE_KEY
export CONTRACT_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
printf "\nDeploying Proxy contract...\n"
DEPLOY_WAKURLN_PROXY_OUTPUT=$(ETH_FROM=$ETH_FROM forge script script/Deploy.s.sol --broadcast -vvv --rpc-url http://foundry:8545 --tc DeployProxy --private-key $PRIVATE_KEY)
if [ $? -ne 0 ]; then
echo "Error: Proxy contract deployment failed"
echo "Forge output: $DEPLOY_WAKURLN_PROXY_OUTPUT"
exit 1
fi
export RLN_CONTRACT_ADDRESS=$(echo "$DEPLOY_WAKURLN_PROXY_OUTPUT" | grep -o "0: address 0x[a-fA-F0-9]\{40\}" | head -n1 | cut -d' ' -f3)
validate_address "$RLN_CONTRACT_ADDRESS" "RLN Proxy"
# 6. Contract deployment completed
echo "\nContract deployment completed successfully"
echo "TOKEN_ADDRESS: $TOKEN_ADDRESS"
echo "CONTRACT_ADDRESS: $CONTRACT_ADDRESS"
echo "\nEach account registering a membership needs to first mint the token and approve the contract to spend it on their behalf."
printf "\nContract deployment completed successfully"
printf "\nTOKEN_ADDRESS: $TOKEN_ADDRESS"
printf "\nRLN_CONTRACT_ADDRESS: $RLN_CONTRACT_ADDRESS"
printf "\nEach account registering a membership needs to first mint the token and approve the contract to spend it on their behalf."

View File

@ -40,7 +40,7 @@ services:
labels:
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
environment:
- RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-ad0dc9a81d892864ac2576d74e628ce93da592ef}
- RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-e75ac913e579ad872f54b2225eec35d1de3d98b0}
- PRIVATE_KEY=${PRIVATE_KEY}
- RPC_URL=${RPC_URL:-http://foundry:8545}
- ETH_FROM=${ETH_FROM}
@ -85,12 +85,12 @@ services:
entrypoint: sh
environment:
- RPC_URL=${RPC_URL:-http://foundry:8545}
- RLN_CONTRACT_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
- RLN_CONTRACT_ADDRESS=${RLN_CONTRACT_ADDRESS:-0x0165878A594ca255338adfa4d48449f69242Eb8F}
- RLN_CREDENTIAL_PATH=/keystore.json
- RLN_CREDENTIAL_PASSWORD=passw123
- RLN_RELAY_MSG_LIMIT=${RLN_RELAY_MSG_LIMIT:-100}
- RLN_RELAY_EPOCH_SEC=${RLN_RELAY_EPOCH_SEC:-600}
- TOKEN_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
- TOKEN_ADDRESS=${TOKEN_ADDRESS:-0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512}
- PRIVATE_KEY=${PRIVATE_KEY}
command:
- '/opt/run_nwaku.sh'
@ -112,8 +112,8 @@ services:
dockerfile: Dockerfile
environment:
- RPC_URL=${RPC_URL:-http://foundry:8545}
- TOKEN_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
- CONTRACT_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
- TOKEN_ADDRESS=${TOKEN_ADDRESS:-0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512}
- CONTRACT_ADDRESS=${RLN_CONTRACT_ADDRESS:-0x0165878A594ca255338adfa4d48449f69242Eb8F}
- PRIVATE_KEY=${PRIVATE_KEY}
- NUM_NWAKU_NODES=${NUM_NWAKU_NODES:-5}
deploy:

View File

@ -15,4 +15,4 @@ ETH_FROM=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
# RLNv2 limits
RLN_RELAY_MSG_LIMIT=100
RLN_RELAY_EPOCH_SEC=600
RLN_CONTRACT_REPO_COMMIT=ad0dc9a81d892864ac2576d74e628ce93da592ef
RLN_CONTRACT_REPO_COMMIT=e75ac913e579ad872f54b2225eec35d1de3d98b0