Update genesis generation script to use given alloc amounts
This commit is contained in:
parent
a9ebd14276
commit
0a57fe8659
@ -5,13 +5,14 @@ set -e
|
||||
set -u
|
||||
|
||||
# Check args
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <stage0-deployment-dir-absolute> <eth-account-holdings-json-file>"
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <stage0-deployment-dir-absolute> <participant-allocation> <validator-allocation>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STAGE0_DEPLOYMENT_DIR="$1"
|
||||
ETH_ACCOUNT_HOLDINGS_FILE="$2"
|
||||
PARTICIPANT_ALLOCATION="$2"
|
||||
VALIDATOR_ALLOCATION="$3"
|
||||
STAGE1_GENESIS_DIR=stage1-genesis
|
||||
|
||||
# Create a temporary target directory
|
||||
@ -19,13 +20,6 @@ mkdir -p $STAGE1_GENESIS_DIR
|
||||
|
||||
# --------
|
||||
|
||||
# ETH account holdings fetched from the bridge node
|
||||
eth_account_holdings=$(cat $ETH_ACCOUNT_HOLDINGS_FILE)
|
||||
|
||||
echo "Fetched Ethereum account holdings"
|
||||
|
||||
# --------
|
||||
|
||||
# Export onboarding module state from stage0 laconicd chain
|
||||
|
||||
onboarding_state_file="$STAGE1_GENESIS_DIR/stage0-onboarding-state.json"
|
||||
@ -42,15 +36,12 @@ echo "Exported onboarding module state from stage 0 chain"
|
||||
|
||||
# For each participant, using ETH account holdings, figure out balance allocation for stage1
|
||||
stage1_allocations_file="$STAGE1_GENESIS_DIR/stage1-allocations.json"
|
||||
jq -n --argjson holdings "$eth_account_holdings" --argjson participants "$stage0_participants" '
|
||||
jq -n --argjson participants "$stage0_participants" --arg participant_allocation "$PARTICIPANT_ALLOCATION" --arg validator_allocation "$VALIDATOR_ALLOCATION" '
|
||||
[
|
||||
$holdings[] |
|
||||
. as $holding |
|
||||
$participants[] |
|
||||
select((.nitro_address | ascii_downcase) == ($holding.nitro_address | ascii_downcase)) |
|
||||
{
|
||||
cosmos_address: .cosmos_address,
|
||||
balance: $holding.balance
|
||||
balance: (if .role == "validator" then $validator_allocation else $participant_allocation end)
|
||||
}
|
||||
]' > $stage1_allocations_file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user