Skip to content

Commit

Permalink
Add final csv's
Browse files Browse the repository at this point in the history
  • Loading branch information
toshiSat committed Dec 5, 2024
1 parent 373f8cd commit 4706d64
Show file tree
Hide file tree
Showing 5 changed files with 726,710 additions and 32 deletions.
15 changes: 3 additions & 12 deletions scripts/add-claim-records.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

# Input files and genesis file
CHAIN1_CSV="./data/arkeo_airdrop_bech32.csv" # Replace with the actual filename for the first chain
CHAIN2_CSV="./data/combined_eth_airdrop.csv" # Replace with the actual filename for the second chain
CHAIN1_CSV="./data/arkeo_airdrop.csv"
CHAIN2_CSV="./data/eth_airdrop.csv"
GENESIS_FILE="~/.arkeo/config/genesis.json"
TEMP_FILE="/tmp/genesis_temp.json"

Expand All @@ -12,11 +12,6 @@ if [ ! -f "$CHAIN1_CSV" ] || [ ! -f "$CHAIN2_CSV" ]; then
exit 1
fi

# if [ ! -f "$GENESIS_FILE" ]; then
# echo "Genesis file not found!"
# exit 1
# fi

# Function to process a CSV file and add entries to the genesis file
add_claim_records() {
local csv_file="$1"
Expand All @@ -27,7 +22,6 @@ add_claim_records() {

# Loop through each line in the CSV file (skip the header)
while IFS=, read -r address amount; do
# Multiply the amount by 10^9
amount_claim=$(echo "scale=0; $amount * 100000000 / 3" | bc)
amount_vote=$(echo "scale=0; $amount * 100000000 / 3" | bc)
amount_delegate=$(echo "scale=0; $amount * 100000000 / 3" | bc)
Expand All @@ -38,18 +32,15 @@ add_claim_records() {
records+=","
done < <(tail -n +2 "$csv_file")

# Remove the trailing comma and close the JSON array
records="${records%,}]"

echo "Final JSON Records Array: $records"

# Add the batch of records to the genesis.json in one operation
jq --argjson new_records "$records" '.app_state.claimarkeo.claim_records += $new_records' <~/.arkeo/config/genesis.json >/tmp/genesis.json
mv /tmp/genesis.json ~/.arkeo/config/genesis.json
}

# Process CSV files for each chain
add_claim_records "$CHAIN1_CSV" "ARKEO"
add_claim_records "$CHAIN2_CSV" "ETHEREUM"

echo "Updated genesis.json with new claim records for both chains."
echo "Updated genesis.json with new claim records for arkeo and ethereum."
Loading

0 comments on commit 4706d64

Please sign in to comment.