diff --git a/src/services/evm/erc20.service.ts b/src/services/evm/erc20.service.ts index 2b82fb959..f742e38b8 100644 --- a/src/services/evm/erc20.service.ts +++ b/src/services/evm/erc20.service.ts @@ -180,10 +180,14 @@ export default class Erc20Service extends BullableService { erc20Activities )}` ); + const sortedErc20Activities = erc20Activities.sort( + (a, b) => + a.cosmos_tx_id - b.cosmos_tx_id || a.evm_event_id - b.evm_event_id + ); await knex .batchInsert( 'erc20_activity', - erc20Activities, + sortedErc20Activities, config.erc20.chunkSizeInsert ) .transacting(trx); diff --git a/src/services/evm/erc20_handler.ts b/src/services/evm/erc20_handler.ts index c17251997..125b72978 100644 --- a/src/services/evm/erc20_handler.ts +++ b/src/services/evm/erc20_handler.ts @@ -147,6 +147,7 @@ export class Erc20Handler { height: e.block_height, tx_hash: e.tx_hash, evm_tx_id: e.evm_tx_id, + cosmos_tx_id: e.tx_id, }); } catch (e) { logger.error(e); @@ -247,6 +248,7 @@ export class Erc20Handler { height: e.block_height, tx_hash: e.tx_hash, evm_tx_id: e.evm_tx_id, + cosmos_tx_id: e.tx_id, }); } catch (e) { logger.error(e); @@ -289,6 +291,7 @@ export class Erc20Handler { height: e.block_height, tx_hash: e.tx_hash, evm_tx_id: e.evm_tx_id, + cosmos_tx_id: e.tx_id, }); } catch (e) { logger.error(e); @@ -316,6 +319,7 @@ export class Erc20Handler { height: e.block_height, tx_hash: e.tx_hash, evm_tx_id: e.evm_tx_id, + cosmos_tx_id: e.tx_id, }); } catch (e) { logger.error(e);