Skip to content

Commit 0b7484e

Browse files
authored
fix: correct inverted balance/min_base comparison in OPG token error message (#219)
1 parent 18a8562 commit 0b7484e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/opengradient/client/opg_token.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def ensure_opg_approval(
204204
raise ValueError(f"Wallet {owner} has no OPG tokens. Fund the wallet before approving.")
205205
elif min_base > balance:
206206
raise ValueError(
207-
f"Wallet {owner} has less OPG tokens than the minimum allowance ({min_base} < {balance}). "
208-
f"Fund the wallet with at least {min_base / 10**18} OPG before approving."
207+
f"Wallet {owner} has insufficient OPG balance: has {balance / 10**18:.6f} OPG, "
208+
f"but the minimum required is {min_base / 10**18:.6f} OPG. Fund the wallet before approving."
209209
)
210210
elif approve_base > balance:
211211
logger.warning(
@@ -222,3 +222,4 @@ def ensure_opg_approval(
222222
approve_base,
223223
)
224224
return _send_approve_tx(wallet_account, w3, token, owner, spender, approve_base)
225+

0 commit comments

Comments
 (0)