Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions starport/pkg/cosmosfaucet/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ func (f Faucet) Transfer(ctx context.Context, toAccountAddress string, amount ui
return err
}

if f.coinsMax[denom] != 0 && totalSent >= f.coinsMax[denom] {
return fmt.Errorf("account has reached maximum credit allowed per account (%d)", f.coinsMax[denom])
if f.coinsMax[denom] != 0 {
if totalSent >= f.coinsMax[denom] {
return fmt.Errorf("account has reached maximum credit allowed per account (%d)", f.coinsMax[denom])
}

if (totalSent + amount) >= f.coinsMax[denom] {
return fmt.Errorf("account is about to reach maximum credit allowed per account. it can only receive up to (%d) in total", f.coinsMax[denom])
}
}

fromAccount, err := f.runner.ShowAccount(ctx, f.accountName)
Expand Down