BoostryJP/ibet-Prime

[FEATURE] Reduce blockchain call of `indexer_Position` batch to run `sync_issuer` only once when token is issued

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.

  • Currently, indexer_Position batches run sync_issuer every sync cycle and some of unnecessary blockchain calls are occurring.

async def __sync_issuer(self, db_session: AsyncSession):
"""Synchronize issuer position"""
for token in self.token_list.values():
try:
issuer_address = await AsyncContractUtils.call_function(
contract=token,
function_name="owner",
args=(),
default_returns=ZERO_ADDRESS,
)
balance, pending_transfer = await self.__get_account_balance_token(
token, issuer_address
)
await self.__sink_on_position(
db_session=db_session,
token_address=to_checksum_address(token.address),
account_address=issuer_address,
balance=balance,
pending_transfer=pending_transfer,
)
except Exception as e:
raise e

  • From a performance perspective, it is better to reduce unnecessary blockchain calls performed in indexer_Position batches.

Describe the solution you'd like

  • Reduce blockchain call of indexer_Position batch to run sync_issuer only once when token is issued.