MrBoec/scripts/bags-generator.sh
Uncle Stretch 66719626bb
inital commit, which is clearly not initial
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2024-10-03 15:38:52 +03:00

43 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
runtime="casper"
bags=200
while getopts r:b:t:e: flag
do
case "${flag}" in
r) runtime=${OPTARG};;
b) bags=${OPTARG};;
t) total=${OPTARG};;
e) existential=${OPTARG};;
esac
done
if [[ -z "$total" ]]; then
echo "### ERROR: -t flag (total supply) should be set."
exit
fi
if [[ -z "$existential" ]]; then
echo "### ERROR: -e flag (existential deposit) should be set."
exit
fi
echo -e "### ${runtime} runtime will be used with ${bags} bags"
echo -e "### while total issuance is ${total} and existential deposit ${existential}"
read -p "### Do you want to regenerate 'bags_thresholds.rs' file? (Y/n)? " answer
if [ $answer != ${answer#[Yy]} ]; then
cargo run --package ghost-voter-bags -- \
--n-bags=${bags} \
--runtime=${runtime} \
--output=$PWD/runtime/${runtime}/src/bag_thresholds.rs \
--total-issuance=${total} \
--minimum-balance=${existential}
echo "### Bags generated succefully"
else
exit
fi