47 lines
1.1 KiB
Bash
Executable File
47 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Exit on error
|
|
set -e
|
|
set -u
|
|
|
|
# Check args
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Usage: $0 <testnet-state-json-file-path>"
|
|
exit 1
|
|
fi
|
|
|
|
TESTNET_STATE_FILE="$1"
|
|
MAINNET_GENESIS_DIR=mainnet-genesis
|
|
|
|
# Create a temporary target directory
|
|
mkdir -p $MAINNET_GENESIS_DIR
|
|
|
|
# --------
|
|
|
|
# Copy testnet state file to required dir
|
|
cp $TESTNET_STATE_FILE $MAINNET_GENESIS_DIR/testnet-state.json
|
|
|
|
# --------
|
|
|
|
# Run a script with cerc/laconicd:local to generate the genesis file
|
|
# with onboarding module state and given allocations
|
|
docker run -it \
|
|
-v ./$MAINNET_GENESIS_DIR:/root/.laconicd \
|
|
-v ./scripts:/scripts \
|
|
-e "CHAIN_ID=$CHAIN_ID" \
|
|
-e "EARLY_SUPPORTS_ACC_ADDRESS=$EARLY_SUPPORTS_ACC_ADDRESS" \
|
|
-e "LPS_LOCKUP_ACC_ADDRESS=$LPS_LOCKUP_ACC_ADDRESS" \
|
|
cerc/laconicd:local bash -c "/scripts/genesis.sh"
|
|
|
|
# Copy over the genesis file to output folder
|
|
OUTPUT_DIR=output
|
|
mkdir -p $OUTPUT_DIR
|
|
cp ./$MAINNET_GENESIS_DIR/config/genesis.json $OUTPUT_DIR/genesis.json
|
|
|
|
echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
|
|
|
# --------
|
|
|
|
# Clean up
|
|
echo "Please remove the temporary data directory: sudo rm -rf $MAINNET_GENESIS_DIR"
|