From 227ea1ea8dbb820702e8efaaa17458260d1f900a Mon Sep 17 00:00:00 2001 From: n3wbie Date: Thu, 26 Dec 2024 21:16:51 +0900 Subject: [PATCH] chore: apply tlin suggestion --- launchpad/launchpad_deposit.gno | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/launchpad/launchpad_deposit.gno b/launchpad/launchpad_deposit.gno index 8bb68eeb..5886e537 100644 --- a/launchpad/launchpad_deposit.gno +++ b/launchpad/launchpad_deposit.gno @@ -482,22 +482,23 @@ func checkDepositConditions(project Project) { for _, condition := range project.conditions { if condition.minAmount == 0 { continue + } + + // check balance + var balance uint64 + if condition.tokenPath == consts.GOV_XGNS_PATH { + balance = xgns.BalanceOf(a2u(caller)) } else { - // check balance - var balance uint64 - if condition.tokenPath == consts.GOV_XGNS_PATH { - balance = xgns.BalanceOf(a2u(caller)) - } else { - balance = common.BalanceOf(condition.tokenPath, caller) - } - if balance < condition.minAmount { - panic(addDetailToError( - errNotEnoughBalance, - ufmt.Sprintf("launchpad_deposit.gno__checkDepositConditions() || insufficient balance(%d) for token(%s)", balance, condition.tokenPath), - )) - } + balance = common.BalanceOf(condition.tokenPath, caller) + } + if balance < condition.minAmount { + panic(addDetailToError( + errNotEnoughBalance, + ufmt.Sprintf("launchpad_deposit.gno__checkDepositConditions() || insufficient balance(%d) for token(%s)", balance, condition.tokenPath), + )) } } + } func checkProjectActive(project Project) bool {