Skip to content

Commit

Permalink
hotfix v2: fix 18d coins support for faucets (#462)
Browse files Browse the repository at this point in the history
* fix faucet amount based on length of the coins

* try fix faucet amounts

* fix faucet amounts and validator info
  • Loading branch information
Anmol1696 authored Jun 6, 2024
1 parent 1821c44 commit 9bcc404
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function cosmos-sdk-version-default() {
$CHAIN_BIN tx staking create-validator \
--pubkey=$($CHAIN_BIN tendermint show-validator) \
--moniker $VAL_NAME \
--amount 100000000000000000000inj \
--amount 10000000000000000inj \
--chain-id $CHAIN_ID \
--from $VAL_NAME \
--commission-rate="0.10" \
Expand Down
23 changes: 20 additions & 3 deletions starship/charts/devnet/templates/chains/cosmos/genesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,16 @@ spec:
do
var="FAUCET_CREDIT_AMOUNT_$(printf '%s\n' ${coin//[[:digit:]]/} | tr '[:lower:]' '[:upper:]')"
amt="${coin//[!0-9]/}"
export $var=$((amt/10000))
if [ ${#amt} -gt 18 ]; then
creditAmt=$(echo $amt | sed -e "s/000000000$//")
feesAmt=$(echo $amt | sed -e "s/0000000000000$//")
else
creditAmt=$(echo $amt | sed -e "s/0000$//")
feesAmt=$(echo $amt | sed -e "s/000000$//")
fi
export $var="$creditAmt"
done
export FAUCET_PATH_PATTERN="${HD_PATH:0:$((${#HD_PATH}-1))}a"
Expand Down Expand Up @@ -336,11 +345,19 @@ spec:
do
amt="${coin//[!0-9]/}"
denom="${coin//[0-9]/}"
creditAmt=$(echo ${coin//[!0-9]/} | sed -e "s/0000$//")
# Calculate the order of magnitude
if [ ${#amt} -gt 18 ]; then
creditAmt=$(echo $amt | sed -e "s/000000000$//")
feesAmt=$(echo $amt | sed -e "s/000000000000$//")
else
creditAmt=$(echo $amt | sed -e "s/0000$//")
feesAmt=$(echo $amt | sed -e "s/000000$//")
fi
if [[ $CREDIT_COINS == "" ]]
then
CREDIT_COINS="$creditAmt$denom"
feesAmt=$(echo ${coin//[!0-9]/} | sed -e "s/0000000$//")
FEES="$feesAmt$denom"
else
CREDIT_COINS="${CREDIT_COINS},$creditAmt$denom"
Expand Down
1 change: 1 addition & 0 deletions starship/tests/e2e/configs/injective.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ chains:
rest: 1313
rpc: 26653
exposer: 38083
faucet: 8003
- id: cosmoshub-4
name: cosmoshub
numValidators: 1
Expand Down

0 comments on commit 9bcc404

Please sign in to comment.