From 62e64ba3643a5491edb9df7f2d647b5c5b604ed7 Mon Sep 17 00:00:00 2001 From: Philipp Werner <22914157+philippwerner@users.noreply.github.com> Date: Mon, 13 Apr 2026 17:26:31 +0200 Subject: [PATCH] QUTIL: add func for getting balances of 16 entities --- src/contracts/QUtil.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/contracts/QUtil.h b/src/contracts/QUtil.h index f88081158..f30d16ea8 100644 --- a/src/contracts/QUtil.h +++ b/src/contracts/QUtil.h @@ -1578,6 +1578,37 @@ struct QUTIL : public ContractBase LOG_INFO(locals.log); } + /**************************************/ + /* GET BALANCE BULK REQUEST */ + /**************************************/ + + struct GetBalances16_input + { + Array publicKeys; + }; + + struct GetBalances16_output + { + Array balances; + }; + + struct GetBalances16_locals + { + Entity entity; + uint32 i; + }; + + PUBLIC_FUNCTION_WITH_LOCALS(GetBalances16) + { + for (locals.i = 0; locals.i < input.publicKeys.capacity(); ++locals.i) + { + if (qpi.getEntity(input.publicKeys.get(locals.i), locals.entity)) + { + output.balances.set(locals.i, locals.entity.incomingAmount - locals.entity.outgoingAmount); + } + } + } + /**************************************/ /* SHAREHOLDER PROPOSALS */ /**************************************/ @@ -1617,6 +1648,7 @@ struct QUTIL : public ContractBase REGISTER_USER_FUNCTION(GetPollInfo, 6); REGISTER_USER_FUNCTION(GetFees, 7); REGISTER_USER_FUNCTION(QueryFeeReserve, 8); + REGISTER_USER_FUNCTION(GetBalances16, 9); REGISTER_USER_PROCEDURE(SendToManyV1, 1); REGISTER_USER_PROCEDURE(BurnQubic, 2);