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
32 changes: 32 additions & 0 deletions src/contracts/QUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,37 @@ struct QUTIL : public ContractBase
LOG_INFO(locals.log);
}

/**************************************/
/* GET BALANCE BULK REQUEST */
/**************************************/

struct GetBalances16_input
{
Array<id, 16> publicKeys;
};

struct GetBalances16_output
{
Array<sint64, 16> 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 */
/**************************************/
Expand Down Expand Up @@ -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);
Expand Down
Loading