Skip to content

Commit

Permalink
Edge case fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Jun 14, 2024
1 parent a58cb76 commit 3476b6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/genesis_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,20 @@ def set_balance(genesis, address, new_balance, denom):

def increase_balance(genesis, address, new_balance, denom):
account_found = False
denom_found = False

for balance in genesis["app_state"]["bank"]["balances"]:
if balance["address"] == address:
account_found = True
for amount in balance["coins"]:
if amount["denom"] == denom:
amount["amount"] = str(int(amount["amount"]) + new_balance)
account_found = True
denom_found = True
break

if not denom_found:
balance["coins"].append({"amount": str(new_balance), "denom": denom})


if not account_found:
new_balance_entry = {
Expand Down

0 comments on commit 3476b6f

Please sign in to comment.