From 5dfd2cc0b72d14190d08be40b6792859684b7679 Mon Sep 17 00:00:00 2001 From: AMATH <116212274+amathxbt@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:40:25 +0100 Subject: [PATCH] fix: correct inverted balance/min_base comparison in OPG token error message --- src/opengradient/client/opg_token.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/opengradient/client/opg_token.py b/src/opengradient/client/opg_token.py index efcca7b..a98a5a8 100644 --- a/src/opengradient/client/opg_token.py +++ b/src/opengradient/client/opg_token.py @@ -204,8 +204,8 @@ def ensure_opg_approval( raise ValueError(f"Wallet {owner} has no OPG tokens. Fund the wallet before approving.") elif min_base > balance: raise ValueError( - f"Wallet {owner} has less OPG tokens than the minimum allowance ({min_base} < {balance}). " - f"Fund the wallet with at least {min_base / 10**18} OPG before approving." + f"Wallet {owner} has insufficient OPG balance: has {balance / 10**18:.6f} OPG, " + f"but the minimum required is {min_base / 10**18:.6f} OPG. Fund the wallet before approving." ) elif approve_base > balance: logger.warning( @@ -222,3 +222,4 @@ def ensure_opg_approval( approve_base, ) return _send_approve_tx(wallet_account, w3, token, owner, spender, approve_base) +